Well... it depends what the XPathFactory.newInstance() method actually does in order to load the class. For example it may try to walk up the stack and load from the calling classloader. This is the JRE we're talking about, so you have to expect it to be batshit crazy and as complicated as possible!
I think in this scenario you should probably add the package "com.sun.org.apache.xpath.internal.jaxp" to bootdelegation, since it isn't a real dependency of your bundle, and the JRE is assuming that it's always visible. I'd like to hear the opinion of others on this though. Neil On Wed, Jul 11, 2012 at 12:29 PM, Dan Gravell <[email protected]> wrote: > I'm a little puzzled about this. I have the following piece of code: > > XPathFactory xpathFactory = XPathFactory.newInstance(); > > I have the following import in the manifest for the bundle containing the > above code: > > Import-Package: javax.xml.xpath > > When I run, I get: > > java.lang.RuntimeException: XPathFactory#newInstance() failed to create an > XPathFactory for the default object model: > http://java.sun.com/jaxp/xpath/dom with the > XPathFactoryConfigurationException: > javax.xml.xpath.XPathFactoryConfigurationException: No XPathFactory > implementation found for the object model: > http://java.sun.com/jaxp/xpath/dom > at javax.xml.xpath.XPathFactory.newInstance(XPathFactory.java:98) > > It looks like XPath tries to load the class > "com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl". > > Shouldn't this work? I only need to import the package for the API I use, > not the impl too right? > > Do I need to add com.sun.org.apache.xpath.internal.jaxp to the > Export-Packages on my system bundle fragment? If so, why? I thought this > was only required if I was directly > accessing com.sun.org.apache.xpath.internal.jaxp (with a requisite > Import-Package) from my bundle. > > Dan --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

