While upgrading Java 7 to Java 8 in my webapplication I am having this problem with Saxon:
javax.xml.xpath.XPathFactoryConfigurationException: java.util.ServiceConfigurationError: javax.xml.xpath.XPathFactory: jar:file:/C:/Users/abc/.m2/repository /net/sf/saxon/saxon-xpath/9.1.0.8/saxon-xpath-9.1.0.8.jar!/META-INF/services/javax.xml.xpath.XPathFactory:2: Illegal configuration-file syntax at java.util.ServiceLoader.fail(ServiceLoader.java:239) at java.util.ServiceLoader.fail(ServiceLoader.java:245) at java.util.ServiceLoader.parseLine(ServiceLoader.java:265) at java.util.ServiceLoader.parse(ServiceLoader.java:307) at java.util.ServiceLoader.access$200(ServiceLoader.java:185) at java.util.ServiceLoader$LazyIterator.hasNextService(ServiceLoader.java:357) at java.util.ServiceLoader$LazyIterator.hasNext(ServiceLoader.java:393) at java.util.ServiceLoader$1.hasNext(ServiceLoader.java:474) at javax.xml.xpath.XPathFactoryFinder$2.run(XPathFactoryFinder.java:345) at javax.xml.xpath.XPathFactoryFinder$2.run(XPathFactoryFinder.java:341) at java.security.AccessController.doPrivileged(Native Method) at javax.xml.xpath.XPathFactoryFinder.findServiceProvider(XPathFactoryFinder.java:341) at javax.xml.xpath.XPathFactoryFinder._newFactory(XPathFactoryFinder.java:212) at javax.xml.xpath.XPathFactoryFinder.newFactory(XPathFactoryFinder.java:137) at javax.xml.xpath.XPathFactory.newInstance(XPathFactory.java:190)
I upgraded saxon to Saxon HE but it doesnt work:
Q{java:org.apache.commons.lang3.StringUtils}isBlank(). Reflexive calls to Java methods are not available under Saxon-HE
at net.sf.saxon.style.StylesheetModule.loadStylesheet(StylesheetModule.java:261) at net.sf.saxon.style.Compilation.compileSingletonPackage(Compilation.java:107) at net.sf.saxon.s9api.XsltCompiler.compile(XsltCompiler.java:785) at net.sf.saxon.jaxp.SaxonTransformerFactory.newTemplates(SaxonTransformerFactory.java:149)
Moving to licensed Saxon PE or other is out of the question :/
I am not sure why but the application uses XpathFactory like that:
XPath xpath = XPathFactory.newInstance(NamespaceConstant.OBJECT_MODEL_SAXON).newXPath();
I don't know why this object model had been chosen, not for example OBJECT_MODEL_DOM4J
I am wondering if:
1) There is some free for commercial use saxon that would work in Java 8 ? I doesn't have to be the newest one, we are using 9.1.0.8 or 9.1.0.6J.
2) What is this NamespaceConstant.OBJECT_MODEL_SAXON, is it possible to resign from Saxon and move to OBJECT_MODEL_DOM4J and use dom4j instead or maybe there is other way to implement something like that using free library?
XPath xpath = XPathFactory.newInstance(NamespaceConstant.OBJECT_MODEL_SAXON).newXPath();
xpath.setNamespaceContext(new NamespaceContextMap("a12i", "http://my-application/a12"));
return xpath.compile(MY_XPATH_QUERY);