[ 
https://issues.apache.org/jira/browse/CAMEL-5798?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13499560#comment-13499560
 ] 

Bengt Rodehav commented on CAMEL-5798:
--------------------------------------

I attached a sample maven project with a simple, spring based, route that uses 
xpath and saxon. I took the camel-example-osgi project and modified it a bit.

+On *ServiceMix 4.4.2* this works:+

* features:install camel-saxon
* install -s mvn:org.apache.camel/saxon-problem/2.10.2

+On *Karaf 2.3.0* this does NOT work:+

* features:install camel-saxon
* features:install camel-spring
* install -s mvn:org.apache.camel/saxon-problem/2.10.2

I get the following exception:

_2012-11-17 23:58:07,640 | ERROR | ExtenderThread-2 | ContextLoaderListener     
       | BundleApplicationContextListener   50 | 75 - 
org.springframework.osgi.extender - 1.2.1 | Application context refresh failed 
(OsgiBundleXmlApplicationContext(bundle=org.apache.camel.saxon-problem, 
config=osgibundle:/META-INF/spring/*.xml))
org.apache.camel.RuntimeCamelException: 
org.apache.camel.FailedToCreateRouteException: Failed to create route route1 
at: >>> Choice[[When[xpath{/Expression_to_match} -> [To[log:match]]]] 
Otherwise[[To[log:nomatch]]]] <<< in route: Route[[From[file://in]] -> 
[Choice[[When[xpath{/Expression_t... because of 
javax.xml.xpath.XPathFactoryConfigurationException: No XPathFctory 
implementation found for the object model: http://saxon.sf.net/jaxp/xpath/om
        at 
org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1270)[68:org.apache.camel.camel-core:2.10.2]
        at 
org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:120)[79:org.apache.camel.camel-spring:2.10.2]
        at 
org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:280)[79:org.apache.camel.camel-spring:2.10.2]
        at 
org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)[59:org.springframework.context:3.0.7.RELEASE]
        at 
org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:303)[59:org.springframework.context:3.0.7.RELEASE]
        at 
org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:911)[59:org.springframework.context:3.0.7.RELEASE]
        at 
org.springframework.osgi.context.support.AbstractOsgiBundleApplicationContext.finishRefresh(AbstractOsgiBundleApplicationContext.java:235)[74:org.springframework.osgi.core:1.2.1]
        at 
org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:358)[74:org.springframework.osgi.core:1.2.1]
        at 
org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)[74:org.springframework.osgi.core:1.2.1]
        at 
org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)[74:org.springframework.osgi.core:1.2.1]
        at 
org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)[75:org.springframework.osgi.extender:1.2.1]
        at java.lang.Thread.run(Thread.java:662)[:1.6.0_22]
Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create 
route route1 at: >>> Choice[[When[xpath{/Expression_to_match} -> 
[To[log:match]]]] Otherwise[[To[log:nomatch]]]] <<< in route: 
Route[[From[file://in]] -> [Choice[[When[xpath{/Expression_t... because of 
javax.xml.xpath.XPathFactoryConfigurationException: No XPathFctory 
implementation found for the object model: http://saxon.sf.net/jaxp/xpath/om
        at 
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:873)[68:org.apache.camel.camel-core:2.10.2]
        at 
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:171)[68:org.apache.camel.camel-core:2.10.2]
        at 
org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:722)[68:org.apache.camel.camel-core:2.10.2]
        at 
org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1789)[68:org.apache.camel.camel-core:2.10.2]
        at 
org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1575)[68:org.apache.camel.camel-core:2.10.2]
        at 
org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1444)[68:org.apache.camel.camel-core:2.10.2]
        at 
org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:179)[79:org.apache.camel.camel-spring:2.10.2]
        at 
org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:60)[68:org.apache.camel.camel-core:2.10.2]
        at 
org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1412)[68:org.apache.camel.camel-core:2.10.2]
        at 
org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:228)[79:org.apache.camel.camel-spring:2.10.2]
        at 
org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:118)[79:org.apache.camel.camel-spring:2.10.2]
        ... 10 more
Caused by: org.apache.camel.RuntimeExpressionException: 
javax.xml.xpath.XPathFactoryConfigurationException: No XPathFctory 
implementation found for the object model: http://saxon.sf.net/jaxp/xpath/om
        at 
org.apache.camel.builder.xml.XPathBuilder.getNamespaceContext(XPathBuilder.java:460)[68:org.apache.camel.camel-core:2.10.2]
        at 
org.apache.camel.builder.xml.XPathBuilder.setNamespaces(XPathBuilder.java:479)[68:org.apache.camel.camel-core:2.10.2]
        at 
org.apache.camel.model.language.NamespaceAwareExpression.configureNamespaceAware(NamespaceAwareExpression.java:75)[68:org.apache.camel.camel-core:2.10.2]
        at 
org.apache.camel.model.language.NamespaceAwareExpression.configurePredicate(NamespaceAwareExpression.java:69)[68:org.apache.camel.camel-core:2.10.2]
        at 
org.apache.camel.model.language.XPathExpression.configurePredicate(XPathExpression.java:184)[68:org.apache.camel.camel-core:2.10.2]
        at 
org.apache.camel.model.language.ExpressionDefinition.createPredicate(ExpressionDefinition.java:161)[68:org.apache.camel.camel-core:2.10.2]
        at 
org.apache.camel.model.language.XPathExpression.createPredicate(XPathExpression.java:141)[68:org.apache.camel.camel-core:2.10.2]
        at 
org.apache.camel.model.language.ExpressionDefinition.createPredicate(ExpressionDefinition.java:143)[68:org.apache.camel.camel-core:2.10.2]
        at 
org.apache.camel.model.ExpressionNode.createPredicate(ExpressionNode.java:120)[68:org.apache.camel.camel-core:2.10.2]
        at 
org.apache.camel.model.ExpressionNode.createFilterProcessor(ExpressionNode.java:110)[68:org.apache.camel.camel-core:2.10.2]
        at 
org.apache.camel.model.WhenDefinition.createProcessor(WhenDefinition.java:77)[68:org.apache.camel.camel-core:2.10.2]
        at 
org.apache.camel.model.ChoiceDefinition.createProcessor(ChoiceDefinition.java:137)[68:org.apache.camel.camel-core:2.10.2]
        at 
org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:441)[68:org.apache.camel.camel-core:2.10.2]
        at 
org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:179)[68:org.apache.camel.camel-core:2.10.2]
        at 
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:870)[68:org.apache.camel.camel-core:2.10.2]
        ... 20 more
Caused by: javax.xml.xpath.XPathFactoryConfigurationException: No XPathFctory 
implementation found for the object model: http://saxon.sf.net/jaxp/xpath/om
        at javax.xml.xpath.XPathFactory.newInstance(Unknown Source)[:2.1.0]
        at 
org.apache.camel.builder.xml.XPathBuilder.getXPathFactory(XPathBuilder.java:418)[68:org.apache.camel.camel-core:2.10.2]
        at 
org.apache.camel.builder.xml.XPathBuilder.getNamespaceContext(XPathBuilder.java:456)[68:org.apache.camel.camel-core:2.10.2]
        ... 34 more_

+On the other hand, on *Karaf 2.3.0* this does work:+

* features:install camel-core
* features:install camel-spring
* install -s 
mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.xmlresolver/1.2_5
* install -s 
mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon/9.4.0.4_1
* install -s mvn:org.apache.camel/saxon-problem/2.10.2

This implies that the xmlresolver is needed and is in fact present by default 
in ServiceMix 4.4.2.

+But, strangely enough, this does NOT work on *Karaf 2.3.0*:+

* features:install camel-core
* features:install camel-spring
* install -s 
mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.xmlresolver/1.2_5
* install -s 
mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon/9.3.0.11_2
* install -s mvn:org.apache.camel/saxon-problem/2.10.2

I just changed the Saxon version from the latest to the one used in the 
camel-saxon feature.

I'm not sure what this means. It seems like the xmlresolver is necessary but I 
do not know why it only works with a newer Saxon. I also don't know what makes 
it work under ServiceMix 4.4.2.

                
> camel-saxon does not work on pure Karaf 2.3.0
> ---------------------------------------------
>
>                 Key: CAMEL-5798
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5798
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-saxon
>    Affects Versions: 2.10.2
>            Reporter: Bengt Rodehav
>         Attachments: saxon-problem.zip
>
>
> This has been discussed on the mailing list:
> http://camel.465427.n5.nabble.com/Saxon-and-saxon9he-td5722663.html
> It seems like the camel-saxon feature only has been tested on Servicemix and 
> not on a pure Karaf installation. Servicemix comes with a pre-installed 
> XmlResolver while Karaf doesn't and it seems like camel-saxon requires an 
> XmlResolver. It should therefore be added to the camel-saxon feature.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to