Michael Kay - 2006-10-07

Logged In: YES
user_id=251681

I thought at first this was a duplicate of
https://sourceforge.net/tracker/index.php?func=detail&aid=1553507&group_id=29872&atid=397617,
but although it's related, I don't think that's quite the
case here. Your jaxp.debug output shows that the
META-INF/services/javax.xml.xpath.XPathFactory file, which
should be in saxon8-xpath.jar, wasn't actually found.

I've tried it myself and experienced the same result. I
can't get it to pick the file up from the JAR. To get this
to work, I found I had to explicitly set the Java system
property like this:

System.setProperty("javax.xml.xpath.XPathFactory:http://java.sun.com/jaxp/xpath/dom",
"net.sf.saxon.xpath.XPathFactoryImpl");

I called this explicitly within the init() method of the
servlet, but it should of course be possible to set the
system property via the init-param elements in the web.xml
configuration file instead.

To be honest, it seems more robust to set this as a
configuration file option rather than letting it depend on
what JAR files happen to be around at run-time. But it would
be nice to know why it doesn't work the way the JAXP
documentation says it should: perhaps it's something to do
with tomcat using a custom classLoader.