简体   繁体   中英

Apache Felix + Java EE + OSGi Web-App

I am building an OSGi application with some Java EE features. The thing is that I am looking for a way to package the application along with all its dependencies so a user only executes the jar file and executes the OSGi framework along with osgi app and dependencies. Then the user only goes to web-browser and open the application.

The first problem I've found is to execute a Java-EE application in an OSGi framework (Apache Felix) to just execute it. Which dependencies should I import into Felix to enable Java-EE applications? I have tried some other approaches like:

And still has not managed to get a simple Java-EE Application with JSF, work under OSGi. There is a sort of dependency nightmare going on between OSGi and Java-EE that only Glassfish has managed to accomplish.

Does any body knows how to get a simple Java-EE application to work in Apache Felix? Once we gt this working embedding all this components in one Jar may not be so complicated and Apache Maven Assembly Plugin can help with that.

What you are trying to do is execute something like a traditional WAR file inside OSGi? Technically what you need to do is actually create a 'wab', a web application bundle. To do this you use the maven-bundle-plugin the same way you would to create any other bundle, but you specify that it's a 'wab' (see elsewhere).

Then you need to deploy it into felix in such a way that it uses a 'servlet bridge'. You can do this in vanilla felix, but it's not easy.

Try Apache Karaf. Karaf is a wrapper for Felix that provides neat ways to install sets of libraries that implement 'features'. The feature you need is the 'war' feature, which installs various things including jetty etc.

So at the karaf command line you would do 'features install war' Then drop your wab bundle into the deploy folder and cross your fingers.

Better than that, you can use the karaf-maven-plugin to create your own 'features.xml' file that determines other features, and dependencies your bundle uses, then drop that features.xml file into the deploy folder of Karaf.

If you have any specific questions about that, just let me know. I have examples for just about all of it, but you're on a fairly steep learning curve I'm afraid :(

Check Wisdom Framework .
The documentation is not very good, but it's a nice framework.
I recommend and will use in my next project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM