Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-11599

XPath feature with Saxon implementation broken when ServiceMix jaxp-api is present in the endorsed classpath

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.18.4
    • 2.21.0
    • camel-saxon, osgi
    • None
    • Advanced

    Description

      Due to https://issues.apache.org/jira/browse/SM-3452, org.apache.camel.builder.xml.XPathBuilder throws the following exception on any attempt to use the camel-xpath feature with Saxon enabled in a Karaf container (full distribution):

      2017-07-25 17:16:06,137 | ERROR | lixDispatchQueue | FrameworkEvent ERROR - 
      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 javax.xml.xpath.XPathFactory.newInstance(Unknown Source)[:2.7.0]
      	at org.apache.camel.builder.xml.XPathBuilder.createXPathFactory(XPathBuilder.java:1218)
      	at org.apache.camel.builder.xml.XPathBuilder.doStart(XPathBuilder.java:1173)
      	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
      	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:75)
      	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:60)
      	at org.apache.camel.processor.FilterProcessor.doStart(FilterProcessor.java:119)
      	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
      	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:75)
      	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:60)
      	at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:104)
      	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:62)
      	at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:104)
      	at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:90)
      	at org.apache.camel.processor.ChoiceProcessor.doStart(ChoiceProcessor.java:202)
      	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
      	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:75)
      	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:60)
      	at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:104)
      	at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:90)
      	at org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:80)
      	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
      	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:75)
      	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:60)
      	at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:104)
      	at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:90)
      	at org.apache.camel.processor.RedeliveryErrorHandler.doStart(RedeliveryErrorHandler.java:1466)
      	at org.apache.camel.support.ChildServiceSupport.start(ChildServiceSupport.java:44)
      	at org.apache.camel.support.ChildServiceSupport.start(ChildServiceSupport.java:31)
      	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:75)
      	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:60)
      	at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:104)
      	at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:90)
      	at org.apache.camel.processor.interceptor.DefaultChannel.doStart(DefaultChannel.java:156)
      	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
      	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:75)
      	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:60)
      	at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:104)
      	at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:90)
      	at org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:80)
      	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
      	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:75)
      	at org.apache.camel.impl.RouteService.startChildService(RouteService.java:348)
      	at org.apache.camel.impl.RouteService.doWarmUp(RouteService.java:191)
      	at org.apache.camel.impl.RouteService.warmUp(RouteService.java:141)
      	at org.apache.camel.impl.DefaultCamelContext.doWarmUpRoutes(DefaultCamelContext.java:3666)
      	at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:3573)
      	at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:3359)
      	at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3213)
      	at org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:184)
      	at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3008)
      	at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3004)
      	at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:3027)
      	at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:3004)
      	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
      	at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:2970)
      	at org.apache.camel.blueprint.BlueprintCamelContext.start(BlueprintCamelContext.java:188)
      	at org.apache.camel.blueprint.BlueprintCamelContext.maybeStart(BlueprintCamelContext.java:228)
      	at org.apache.camel.blueprint.BlueprintCamelContext.serviceChanged(BlueprintCamelContext.java:158)
      	at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:991)
      	at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:839)
      	at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:546)
      	at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4557)
      	at org.apache.felix.framework.Felix.registerService(Felix.java:3549)
      	at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:348)
      	at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:355)
      	at org.apache.camel.blueprint.BlueprintCamelContext.init(BlueprintCamelContext.java:108)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.8.0_20]
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[:1.8.0_20]
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_20]
      	at java.lang.reflect.Method.invoke(Method.java:483)[:1.8.0_20]
      	at org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:299)
      	at org.apache.aries.blueprint.container.BeanRecipe.invoke(BeanRecipe.java:980)
      	at org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:736)
      	at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:848)
      	at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:811)
      	at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_20]
      	at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)
      	at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:255)
      	at org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:186)
      	at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:724)
      	at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:411)
      	at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:276)
      	at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:300)
      	at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:269)
      	at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:265)
      	at org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:255)
      	at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500)
      	at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433)
      	at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725)
      	at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463)
      	at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422)
      	at org.apache.felix.framework.util.SecureAction.invokeBundleEventHook(SecureAction.java:1179)
      	at org.apache.felix.framework.util.EventDispatcher.createWhitelistFromHooks(EventDispatcher.java:731)
      	at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:486)
      	at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4541)
      	at org.apache.felix.framework.Felix.startBundle(Felix.java:2172)
      	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998)
      	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:984)
      	at org.apache.karaf.features.internal.service.FeaturesServiceImpl.startBundle(FeaturesServiceImpl.java:1286)
      	at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:846)
      	at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1176)
      	at org.apache.karaf.features.internal.service.FeaturesServiceImpl$1.call(FeaturesServiceImpl.java:1074)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_20]
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_20]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_20]
      	at java.lang.Thread.run(Thread.java:745)[:1.8.0_20]
      

      Due to complexity of propagating the fix through the framework, it might be worth to update org/apache/camel/builder/xml/XPathBuilder.java:1218 to instantiate net.sf.saxon.xpath.XPathFactoryImpl directly, especially considering Saxon manual starting from version 9.7 explicitly says not to consider them a provider of javax.xml.xpath.XPathFactory (http://www.saxonica.com/html/documentation/xpath-api/jaxp-xpath/factory.html)

      Attachments

        Activity

          People

            davsclaus Claus Ibsen
            nvoskresenskiy Nikolay Voskresenskiy
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: