Java – classpath problem using xpathfactory

I encountered the following exception on one of the real-time servers (other servers running the same code seem to have no problem):

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 I have xalan and Saxon jar in my classpath (using IBM Java 1.5)

What do you think? Is there anything else that may be wrong?

Edit:

This is the code that caused the problem:

XPathFactory factory = XPathFactory.newInstance();

It runs on a custom web server roughly based on the Catalina engine

Solution

You need to add the appropriate in the classpath jar. In my example, I used the Saxon he library

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

This error has been in version 9.5 Corrected in 1.5 So you can download latest Saxon 9 he

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>