tags:

views:

283

answers:

2

I keep getting the following exception on one of our live servers (the others running the same code seem ok):

java.lang.RuntimeException: XPathFactory#newInstance() failed to create an XPathFactory for the default object model: http://java.sun.com/jaxp/xpath/domwith the XPathFactoryConfigurationException: javax.xml.xpath.XPathFactoryConfigurationException: No XPathFctory implementation found for the object model: http://java.sun.com/jaxp/xpath/dom
 at javax.xml.xpath.XPathFactory.newInstance(XPathFactory.java:67)

I'm pretty sure that I have the Xalan and Saxon jars in the classpath (using IBM Java 1.5).

Do you have any Ideas what else could be wrong?

Edit:

That's the code that causes the Problem:

            XPathFactory factory = XPathFactory.newInstance();

And it's running on a custom web server that's roughly based on the catalina engine.

+2  A: 

Make sure you have the appropriate xml-apis.jar and xerces jars in your classpath for the version of xalan that you are using (check the release notes for what, exactly, you need). Also make sure you don't have multiples as the xercesImpl.jar, xml-apis.jar and xalan.jar need to be in sync.

Ichorus
A: 

Found the answer myself: The problem is the combination of using Java 5 and having an option

-Djava.endorsed.dirs

set to a directory that contained the xalan.jar.

Once removed everything works again.

Benedikt Eger