|Overriding packages exposed by org.eclipse.osgi [message #903568]
||Fri, 24 August 2012 11:28
| Kevin Milburn
Registered: July 2012
I need to use Xerces 2.11.0 in an RCP application, which requires updated versions of the javax.xml and org.w3c.dom pacakges, but attempting to use them is causing problems.|
If I add Xerces and xml-apis bundles to my plugin, I can use the correct Xerces parser, but it ultimately fails with:
This fails because, the ClassLoader is attempting to find the class in org.eclipse.osgi, which as it draws from the Java runtime (JavaSE 1.7), does not have it.
I've tried overriding the org.osgi.framework.bootdelegation property to prevent some exposure of the packages, which is partially successful. However, if I get my plugin to use my xml-apis bundle first, it then fails with
java.lang.LinkageError: loader constraint violation: loader (instance of org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader) previously initiated loading for a different type with name "org/w3c/dom/Document"
If I attempt to remove the packages from org.osgi.framework.system.packages the app won't start as other parts of the system don't know about my xml-apis bundle. Is there any to do so?
I've also tried adding Xerces to the endorsed libs, this is mostly successfull, but appears to break parts of the WTP, and it doesn't feel right to have to do this in the OSGi world.
Is there some other way to get this to work that I've missed, or any other pointers that could help?
Edit: changing the org.osgi.framework.bootdelegation wasn't necessary, just putting the xml-apis bundle before org.eclipse.core.runtime is enough to trigger the LinkageError.
[Updated on: Fri, 24 August 2012 12:26]
Report message to a moderator
Powered by FUDForum
. Page generated in 0.02059 seconds