Skip to main content

XPathFactory error with Glassfish

1 reply [Last post]
fawzib
Offline
Joined: 2011-08-12
Points: 0

I'm trying to use XPath in a bundle and I'm getting the following exception:

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:101)

The thing is that this is a fresh install of Glassfish 3.1.1 (Build 12) running on Java 1.6. If I make a simple java app:

public static void main(String[] args) {
XPath p=XPathFactory.newInstance().newXPath();
System.out.println(p);
}

It works ok, so my java is not the problem, the problem is something in Glassfish. From what I have googled it seems this is usually a class conflict problem (using xerces/xalan jars in Java 1.5/1.6?). The problem is that I don't know where to start looking. Please help...

The attachment is the testbundle Im using, just an activator trying to get a XPathFactory instance.

AttachmentSize
test_xpath-1.0.0.jar4.06 KB

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
fawzib
Offline
Joined: 2011-08-12
Points: 0

So nothing? Nobody ever try to use XPathFactory in a bundle in glassfish?

Ok, since XPathFactory.newInstance() does not work on Glassfish for the moment I'm calling it directly using:

XPath p=new com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl().newXPath();

I dont like it but at least it works until glassfish get fixed.