CamelCookbook / camel-cookbook-examples

Example source code for Apache Camel Developer's Cookbook
http://www.packtpub.com/apache-camel-developers-cookbook/book
Apache License 2.0
262 stars 188 forks source link

XPathFactory#newInstance() failed to create an XPathFactory #55

Closed jkorab closed 9 years ago

jkorab commented 9 years ago

All tests within org/camelcookbook/security/xmlsecurity fail with similar stacktraces:

XPathFactory#newInstance() failed to create an XPathFactory for the default object model: http://java.sun.com/jaxp/xpath/dom with the XPathFactoryConfigurationException: javax.xml.xpath.XPathFactoryConfigurationException: java.util.ServiceConfigurationError: javax.xml.xpath.XPathFactory: jar:file:/hdd/m2/repository/net/sf/saxon/Saxon-HE/9.5.0.2/Saxon-HE-9.5.0.2.jar!/META-INF/services/javax.xml.xpath.XPathFactory:2: Illegal configuration-file syntax

org.apache.camel.FailedToCreateRouteException: Failed to create route decrypt at: >>> Unmarshal[org.apache.camel.model.dataformat.XMLSecurityDataFormat@101cf747] <<< in route: Route(decrypt)[[From[direct:decrypt]] -> [Unmarshal[org.apac... because of Error creating bean with name 'org.apache.camel.dataformat.xmlsecurity.XMLSecurityDataFormat': Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.camel.dataformat.xmlsecurity.XMLSecurityDataFormat]: Constructor threw exception; nested exception is java.lang.RuntimeException: XPathFactory#newInstance() failed to create an XPathFactory for the default object model: http://java.sun.com/jaxp/xpath/dom with the XPathFactoryConfigurationException: javax.xml.xpath.XPathFactoryConfigurationException: java.util.ServiceConfigurationError: javax.xml.xpath.XPathFactory: jar:file:/hdd/m2/repository/net/sf/saxon/Saxon-HE/9.5.0.2/Saxon-HE-9.5.0.2.jar!/META-INF/services/javax.xml.xpath.XPathFactory:2: Illegal configuration-file syntax at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:1072) at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:196) at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:944) at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:3245) at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:2968) at org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:172) at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2799) at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2795) at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:2818) at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:2795) at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:2764) at org.camelcookbook.security.xmlsecurity.SecurityAsymNamespacesSpringTest.testXmlEncryptionDecryption(SecurityAsymNamespacesSpringTest.java:68) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55) at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55) at org.junit.rules.RunRules.evaluate(RunRules.java:20) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.junit.runners.Suite.runChild(Suite.java:127) at org.junit.runners.Suite.runChild(Suite.java:26) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.junit.runner.JUnitCore.run(JUnitCore.java:160) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:78) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:212) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:68) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140) Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.camel.dataformat.xmlsecurity.XMLSecurityDataFormat': Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.camel.dataformat.xmlsecurity.XMLSecurityDataFormat]: Constructor threw exception; nested exception is java.lang.RuntimeException: XPathFactory#newInstance() failed to create an XPathFactory for the default object model: http://java.sun.com/jaxp/xpath/dom with the XPathFactoryConfigurationException: javax.xml.xpath.XPathFactoryConfigurationException: java.util.ServiceConfigurationError: javax.xml.xpath.XPathFactory: jar:file:/hdd/m2/repository/net/sf/saxon/Saxon-HE/9.5.0.2/Saxon-HE-9.5.0.2.jar!/META-INF/services/javax.xml.xpath.XPathFactory:2: Illegal configuration-file syntax at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:275) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1139) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1042) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:342) at org.apache.camel.spring.spi.SpringInjector.newInstance(SpringInjector.java:39) at org.apache.camel.impl.DefaultDataFormatResolver.resolveDataFormat(DefaultDataFormatResolver.java:57) at org.apache.camel.impl.DefaultCamelContext.resolveDataFormat(DefaultCamelContext.java:3911) at org.apache.camel.model.DataFormatDefinition.createDataFormat(DataFormatDefinition.java:124) at org.apache.camel.model.DataFormatDefinition.getDataFormat(DataFormatDefinition.java:103) at org.apache.camel.model.DataFormatDefinition.getDataFormat(DataFormatDefinition.java:88) at org.apache.camel.model.UnmarshalDefinition.createProcessor(UnmarshalDefinition.java:179) at org.apache.camel.model.ProcessorDefinition.makeProcessorImpl(ProcessorDefinition.java:534) at org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:495) at org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:219) at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:1069) ... 52 more Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.camel.dataformat.xmlsecurity.XMLSecurityDataFormat]: Constructor threw exception; nested exception is java.lang.RuntimeException: XPathFactory#newInstance() failed to create an XPathFactory for the default object model: http://java.sun.com/jaxp/xpath/dom with the XPathFactoryConfigurationException: javax.xml.xpath.XPathFactoryConfigurationException: java.util.ServiceConfigurationError: javax.xml.xpath.XPathFactory: jar:file:/hdd/m2/repository/net/sf/saxon/Saxon-HE/9.5.0.2/Saxon-HE-9.5.0.2.jar!/META-INF/services/javax.xml.xpath.XPathFactory:2: Illegal configuration-file syntax at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:163) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:122) at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:267) ... 68 more Caused by: java.lang.RuntimeException: XPathFactory#newInstance() failed to create an XPathFactory for the default object model: http://java.sun.com/jaxp/xpath/dom with the XPathFactoryConfigurationException: javax.xml.xpath.XPathFactoryConfigurationException: java.util.ServiceConfigurationError: javax.xml.xpath.XPathFactory: jar:file:/hdd/m2/repository/net/sf/saxon/Saxon-HE/9.5.0.2/Saxon-HE-9.5.0.2.jar!/META-INF/services/javax.xml.xpath.XPathFactory:2: Illegal configuration-file syntax at javax.xml.xpath.XPathFactory.newInstance(XPathFactory.java:102) at org.apache.camel.builder.xml.DefaultNamespaceContext.(DefaultNamespaceContext.java:41) at org.apache.camel.dataformat.xmlsecurity.XMLSecurityDataFormat.(XMLSecurityDataFormat.java:143) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:422) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147) ... 70 more

jkorab commented 9 years ago

Seems to be a known bug: https://saxonica.plan.io/issues/1944#note-3