I am having trouble getting XPath to work reliably in an OSGi context. When XPathFactory.newInstance is called, the following code is run (in javax.xml.xpath.XPathFactory):
classLoader = XPathFactory.class.getClassLoader()
The classLoader resolves to null, which causes problems subsequently when the correct XPath implementation is looked up.
I am exporting the sun and com.sun packages to help with previous problems with XPath classloading where internal Sun classes couldn’t be found:
org.osgi.framework.bootdelegation=sun.*,com.sun.*
I’m using Felix.
The null classloader is the bootstrap classloader. Such a class was loaded from the bootstrap class path. This is true even when not using OSGi.