Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
specs-2.9.0
-
None
Description
The method javax.xml.xpath.XPathFactory#newInstance(java.lang.String, java.lang.String, java.lang.ClassLoader) throws the following error whenever org.apache.servicemix.specs.jaxp-api-1.4-2.9.0.jar is present in the jvm endorsed directory:
java.lang.IllegalAccessError: tried to access method javax.xml.xpath.XPathFactoryFinder.createInstance(Ljava/lang/String;)Ljavax/xml/xpath/XPathFactory; from class javax.xml.xpath.XPathFactory at net.nv.test.XPathTest.testIllegalAccess(XPathTest.java:15)
Attached is the project with corresponding unit test for convenience.
The earlier versions affected also include 2.7.0
This is specifically inconvenient since the Karaf 4.x full assembly includes org.apache.servicemix.specs.jaxp-api-1.4-2.7.0.jar in the container endorsed directory (e.g. https://github.com/apache/karaf/blob/karaf-4.0.7/assemblies/apache-karaf/pom.xml), and at the same time Apache Camel since 2.18.x uses this method when initializing the XPath component with Saxon implementation:
https://github.com/apache/camel/blob/camel-2.18.x/camel-core/src/main/java/org/apache/camel/builder/xml/XPathBuilder.java
This results in the Camel XPath feature being completely broken in Karaf container