Classpath issue using XPathFactory

I keep getting the following exception on one of our live servers (others that work with the same code look fine):

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 am sure that I have Xalan and Saxon jars in the classpath (using IBM Java 1.5).

Do you have any ideas what else might be wrong?

Edit:

What causes the code causing the problem:

            XPathFactory factory = XPathFactory.newInstance();

And it runs on a custom web server, which is roughly based on the Catalina engine.

+5
source share
3 answers

Found the answer myself: the problem is a combination of using Java 5 and the option

-Djava.endorsed.dirs

install to the directory containing xalan.jar.

After removal, everything works again.

+3
source

.jar . Saxon-HE.

Saxon9 , , .

​​ 9.5.1.5. , Saxon 9 HE.

+4

Make sure you have the appropriate jml-apis.jar and xerces jars in your class path for your version of xalan (check the release notes for what you need). Also make sure you don't have multiples, since xercesImpl.jar, xml-apis.jar and xalan.jar must be synchronized.

+2
source

All Articles