-
1. Re: Migrating osgi bundles running in Karaf to JBoss 7 as OSGI container
ulrichromahn Nov 9, 2012 7:13 PM (in response to mishra900)Hi,
I just went through this exact exercise and must say that it was rather painless.
We also have a bunch of OSGi bundles build and running in Apache Karaf (we are using 2.2.9). However, we have defined our "application" in a features.xml file which, together with all the bundles gets deployed to a Nexus (Maven) repository. All we have to do in Karaf is actually to specify the URL of that features.xml and do then a features:install <feature name>. It is so convenient and powerful, that I am actually currently investigation how this could be integrated into JBoss AS 7 on top of JBoss OSGi.
So, when I tried to migrate my OSGi-based application over to JBoss AS 7 (I am currently doing this with 7.2.0.Alpha1-SNAPSHOT build locally) I had to do the following steps:
- Determine all my dependencies by examining my features.xml as well as the standard-2.2.9-features.xml and enterprise-2.2.9-features.xml files to figure out what the exact dependencies were.
- Once I had those dependencies determined, I opened the JBOSS_HOME/standalone/configuration/standalone.xml and located the definition of the OSGi Subsystem (<subsystem xmlns="urn:jboss:domain:osgi:1.2" activation="eager">). In that file, I added all my dependencies - preferably in the correct order - as <capabilities>. Here are some examples:
<capability name="org.apache.felix:org.apache.felix.scr:1.6.0" startlevel="2"/>
<capability name="org.apache.felix:org.apache.felix.eventadmin:1.2.6" startlevel="2"/>
<capability name="org.apache.aries:org.apache.aries.util:0.4" startlevel="2"/>
<capability name="org.apache.aries.jmx:org.apache.aries.jmx:0.3" startlevel="2"/>
<capability name="org.apache.aries.proxy:org.apache.aries.proxy:0.4" startlevel="2"/>
<capability name="org.apache.aries.blueprint:org.apache.aries.blueprint:0.4" startlevel="2"/> - Then I started JBoss AS 7 with the OSGi susbsystem starting during boot time (see 'activation="eager"' in the subsystem definition above) looking at the log for possible error messages.
Once all the errors and missing dependencies have been resolved, my application was up-and-running.
One important note, however: not all classes in the JRE standard library get exposed to the OSGi system and you will have to configure that. For example, one of our package had a dependency on 'sun.misc'. In order to add those dependencies, you will have to add a specific system property for the OSGi subsystem. The property definition goes inside the standalone.xml inside the <properties> and looks like (for our application):
<property name="org.osgi.framework.system.packages.extra">
org.apache.log4j;version=1.2,
javax.annotation,
javax.annotation.processing,
sun.misc
</property>
That was basically all I had to do.
Good luck with your migration.
-
2. Re: Migrating osgi bundles running in Karaf to JBoss 7 as OSGI container
mishra900 Nov 10, 2012 1:20 PM (in response to ulrichromahn)Hi ulrichromahn,
I am really excited aftre seeing your reply .. It's really been a great help , Thanks for the help and i am really appriciated ..
Need to understand couple of things add to previous ques : Please correct me if i am wrong ..
Section 2 (From your reply ):
- we can only add external jars (apart from sun JVM related jars ) in to the bundles , which are needed for our osgi bundle dependency ..(correct me if i am wrong)
Section 3 (From your reply ):
- under osgi section inside standalone.xml , we have both capability and properties , so wanted to know does JBoss console displays all the properties configured while starting ...?
One more information wanted to know , my application already running in Fuse has almost 10 different service bundles , hence this all 10 bundles suppose to just moved in to JBOSS_HOME\standalone\deployment folder .. for deployment ... correct me if i am wrong ...
Assume i have some cxf webservices , hence to migrate the webservices , i need to deploy both model and serviceimpl bundles in to JBOSS_HOME\standalone\deployment folder .
So i think if i move all model and serviceimpl bundles as per the order , it should work ..
Thanks again for your help ....
-
3. Re: Migrating osgi bundles running in Karaf to JBoss 7 as OSGI container
thomas.diesler Nov 12, 2012 7:15 AM (in response to mishra900)Folks, have a look at OSGi Roadmap first half 2013
The Karaf integration is at the top of the list and we already made good progress. If you can't wait for the next AS7 release (ETA is not yet known) you could have a look at AS7-5544
Essentially what you do is to execute a simple maven command in the build-modular dir
build-modular]$ mvn -Dmodular=karaf clean install
This should give you a preconfigured Karaf runtime
-
4. Re: Migrating osgi bundles running in Karaf to JBoss 7 as OSGI container
mishra900 Nov 16, 2012 12:03 PM (in response to thomas.diesler)Thanks ulrichromahn,
I am able to configure/deploy the osgi bundles from karaf by adding all the dependency in JBOSS standalone.xml . Now all the bundles are deployed .
But they are not actually starting up . i mean i have basically some cxf endpoint webservices are earlier deployed in KARAF , i am looking at similiar behaviour in JBOSS osgi container too.
i have some WSDL model jars and some services jars which are depend on those model jars . it was running in production seamlessly without any issue .
but now if i am just moving those model and services bundles in to Jboss OSGI , they are not starting even though in the Jboss server.log is showing they are started .
i tried to invoke the cxf-endpoint URL to have a look at if the server WSDL is generated on the server, i am seeing 404 error , which means those cxf end points are not getting created .
Intially i thought may be some how spring auto-waring not happening , but now i can see all spring bundles are also started , but some how , aftre Bundle deployed , Bundle Activator getting called and after that nothing happening ....
Any thoughts ???????????
Thanks,
Biswa
-
5. Re: Migrating osgi bundles running in Karaf to JBoss 7 as OSGI container
thomas.diesler Nov 19, 2012 3:28 AM (in response to mishra900)This may be related to https://issues.jboss.org/browse/AS7-5951