How to configure a system-wide package in osgi?
- by cheng81
I need to made available a library to some bundles. This library makes use of RMI, so it needs (as far as I know, at least) to use the system class loader in order to work (I tried to "osgi-fy" the library, which results in classcastexceptions at runtime). So what I did was to remove the dependencies from the bundles that use that library, compile them with the library included in the property jars.extra.classpath (in the build.properties of the eclipse project).
Then I added
org.osgi.framework.bootdelegation=com.blipsystems.*
in the felix configuration file and started the felix container with the followin command line:
java -classpath lib/blipnetapi.jar -jar bin/felix.jar
..which in turns throwed a NoClassDefFoundException for a class of the blipnetapi.jar library:
ERROR: Error starting file:/home/frza/felix/load/BlipnetApiOsgiService_1.0.0.1.jar (org.osgi.framework.BundleException: Activator start error in bundle BlipnetApiOsgiService [30].)
java.lang.NoClassDefFoundError: com/blipsystems/blipnet/api/util/BlipNetSecurityManager
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
at java.lang.Class.getConstructor0(Class.java:2699)
at java.lang.Class.newInstance0(Class.java:326)
at java.lang.Class.newInstance(Class.java:308)
at org.apache.felix.framework.Felix.createBundleActivator(Felix.java:3525)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:1694)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1621)
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1076)
at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:264)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassNotFoundException: com.blipsystems.blipnet.api.util.BlipNetSecurityManager
at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:726)
at org.apache.felix.framework.ModuleImpl.access$100(ModuleImpl.java:60)
at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1631)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
... 11 more
So my question is: am I missing something? I did something wrong?