• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Do I need OSGi or other technology?

 
Jean Marcel Bacan
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys, I need to develop an application that I cad add or remove jar or classes (Also need un interface to do that). Each one of these classes or jar will execute a different scheduled job.
My idea was an application that read these jars or execute servlets dynamically without know them. While studying OSGi(for a day) I've noticed that i need a container running but
I would like to use weblogic which is the default web server i use for other apps.

Do i really need OSGi?
A small web server that supports jee6 doesn't work?

Any suggestions?

Thanks


 
Jayesh A Lalwani
Rancher
Posts: 2756
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are you trying to do? call classes bundled in third party jars in your web application? or execute servlets from third parties.... inside your servlet?
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A "container" is OSGi's terms could be as simple as one class that you write yourself, or it could be something pre-made like Apache Karaf. But regardless, you can run it in any Java environment, including servlet containers or JEE servers. So the either/or situation that you're asking about really does not exist.

I wrote my own container that consisted of a few classes when I got into OSGi (using the Apache Felix implementation), but that was before Karaf came along. Nowadays I might use that instead of rolling my own; haven't had a chance to check it out in depth, though.

Some of the material linked in the http://www.coderanch.com/how-to/java/OSGiLinks should be interesting.
 
Jean Marcel Bacan
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, I'm studying those links Ulf Dittmer.

What I'm trying to do is have an application running that reads a jar without know it, but starts when I deploy it.

I'm using these Felix with Pax to start a web console. But would be better use a "bundle manager" in my weblogic server.

So when another developer creates a jar with some task, that I and my "Web Console bundle manager" don't know what its, the task can be deployed and started by the Web Console.

Could make myself clear? English its not my native language so my explanation looks confuse.

Thanks for the help.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, it's clear. That's one of the main uses cases for OSGi.
 
Jean Marcel Bacan
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a way that i can copy/paste a jar into some folder and my OSGI container (felix) load and start it?

Thanks
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's pretty much the way it works (or can be made to work, depending on the container).
 
Jean Marcel Bacan
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I could make the Equinox in servlet container work, because we use weblogic. But worked with Felix container with jetty as a bundle, then i deployed the sample-http using the web interface.

There is a updated project or tutorial that I could use? i still prefer the Osgi in the servlet container, to use just weblogic.

Thanks
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Um, tutorial for what? It sounds like you have successfully used the Felix HTTP stuff already ... ?
 
Jean Marcel Bacan
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes I used with maven and could run the webapp and start my bundle.

Talking to my boss he wants something like this:

Deploy an webapp in Weblogic that starts Felix and not Equinox (as i did).
Use just one Servlet that is capable to list and execute any bundle that the name came in the request parameters.

I'm trying now to understand the Sling project, but look likes its too much for what I need, i just want to start felix with one WAR in my weblogic. After this i code a servlet that reads the avaiable bundles in a specific path.

Thanks for help.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It sounds like you need the Apache Felix HTTP Service and the Apache Felix Web Console. Those pages both have instructions how to get started with them.

Or use Karaf: http://karaf.apache.org/manual/2.2.5/users-guide/web-applications.html
 
Jean Marcel Bacan
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Exactly, i did the Servlet bridge sample and get the result:

<OSGi framework started>
*INFO * Failed to instantiate plugin org.apache.felix.webconsole.internal.compendium.ComponentsServlet. Reason: java.lang.NoClassDefFoundError: org.apache.felix.scr.ScrService
*INFO * Failed to instantiate plugin org.apache.felix.webconsole.internal.misc.ShellServlet. Reason: java.lang.NoClassDefFoundError: org.apache.felix.shell.ShellService
## [servlet1] Init with config [org.apache.felix.http.base.internal.handler.ServletConfigImpl@258792]
## [servlet2] Init with config [org.apache.felix.http.base.internal.handler.ServletConfigImpl@d32a52]
## [filter1] Init with config [org.apache.felix.http.base.internal.handler.FilterConfigImpl@1bcbe77]
## [filter2] Init with config [org.apache.felix.http.base.internal.handler.FilterConfigImpl@1bdc523]

webconsole is a bundle, but i don't know how to test it. My http://localhost:7001/bridge/ return 404.

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic