openorb and jdk conflict in OSGI
I'm getting the bellow exception using openorb in osg开发者_开发问答i.
I'm using openorb-1.3.1.jar and jdk1.6. I think both the openorb-1.3.1.jar and rt.jar in jdk is containing many duplicates which is causing the problem. For eg, the bellow error is happening because org.omg.CORBA.ORB class is there in both rt.jar and openorb-1.3.1.jar . Please suggest the correct way of resolving the problem.The exception is like ,
java.lang.LinkageError: loader constraint violation: loader (instance of previosly initiated loading for a different type with name "org/omg/CORBA/ORB" at java.lang.ClassLoader.findBootstrapClass....
Probably openorb is using its own internal copy of the org.omg.CORBA
package, but your own bundles -- which I presume are invoking openorb in some way -- have imported org.omg.CORBA
from the system bundle (meaning they get the one from rt.jar).
Without more information it's difficult to prescribe a single cure, but the principle is to make sure that openorb and all other bundles load org.omg.CORBA
from the same place. That means that EITHER:
- openorb needs to include
org.omg.CORBA
in itsImport-Package
header, so that it gets that package from rt.jar instead of its own internal copy; OR... - your bundles need to import the copy of
org.omg.CORBA
exported by openorb... hopefully it exports it with a version e.g. 1.0.0 so your bundles can sayImport-Package: org.omg.CORBA;version="[1.0.0,2.0.0)"
If you using karaf as your OSGi container. you can edit you karaf "jre.properties", which should be in /karaf/etc. Delete the package which is already in openorb
精彩评论