Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Classpath issue using XPathFactory

Tags:

java

classpath

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.

like image 427
B.E. Avatar asked Apr 28 '09 14:04

B.E.


1 Answers

You need to add the appropriate .jar in your classpath. In my case I used the Saxon-HE library.

There exists a bug in Saxon9 you maybe run into like me.

The bug has been corrected in version 9.5.1.5. So you may download the latest Saxon 9 HE.

like image 98
FiveO Avatar answered Sep 19 '22 06:09

FiveO