Uploaded image for project: 'ServiceMix'
  1. ServiceMix
  2. SM-3452

Method XPathFactory#newInstance(String,String,ClassLoader) broken in jaxp-api-1.4 spec jar

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • specs-2.9.0
    • specs-2.10.0
    • specs
    • 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

      Attachments

        1. jaxpbug.tar.gz
          20 kB
          Nikolay Voskresenskiy

        Activity

          People

            ffang Freeman Yue Fang
            nvoskresenskiy Nikolay Voskresenskiy
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: