I am trying to update the version of camel-saxon being used in my project from 2.13.4 to 3.14.0 while keeping the version of camel-core at 2.13.4. Also I am building with Java 1.8.265. Once I change the version of camel-saxon from 2.13.4 to 3.14.0 in my pom.xml and try building with maven clean install I get the following error:
java.lang.NoSuchMethodError: org.apache.camel.language.xquery.XQueryLanguage.property(Ljava/lang/Class;[Ljava/lang/Object;ILjava/lang/Object;)Ljava/lang/Object;
at org.apache.camel.language.xquery.XQueryLanguage.configureBuilder(XQueryLanguage.java:85)
at org.apache.camel.language.xquery.XQueryLanguage.createExpression(XQueryLanguage.java:80)
at org.apache.camel.language.xquery.XQueryLanguage.createExpression(XQueryLanguage.java:67)
My first thought was to try to upgrade camel-core from 2.13.4 to 3.14.0 but I would like to avoid that if possible for the time being. So is there an api/jar or something else I can use to bridge the gap between camel-core and camel-saxon or is the only way to upgrade camel-saxon by updating both dependencies?
If anyone is interested what error I get when trying to upgrade camel-core to 3.14.0 along with camel-saxon. I get the following error:
org.apache.camel.FailedToCreateRouteException: Failed to create route route2 at: >>> InOut[inOut] <<< in route: Route(route2)[From[vm:urn:myurn] -> [ConvertBodyTo... because of Failed to resolve endpoint: xslt://path/to/file/myfile.xsl?transformerFactory=tFactory due to: Error binding property (transformerFactory=tFactory) with name: transformerFactory on bean: xslt://path/to/file/myfile.xsl?transformerFactory=tFactory with value: tFactory
and route:
<bean id="tFactory" class="net.sf.saxon.TransformerFactoryImpl"/>
<camelContext trace="true" xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="vm:urn:myurn" />
<convertBodyTo type="java.lang.String"/>
<log message="my message" loggingLevel="INFO"
logName="my.logname" />
<inOut uri="xslt:path/to/file/myfile.xsl?transformerFactory=tFactory"/>
<convertBodyTo type="java.lang.String"/>
<log message="my message" loggingLevel="INFO"
logName="my.log" />
<inOut uri="mock:processedout"/>
</route>
</camelContext>
No, your camel dependencies should always match with the version of camel you're using. Sometimes you might want/need to change version of transitive dependency if one of your camel dependencies is using version of a library that has a bug that's been patched in later (minor) version but that's about it.
A lot has changed between Camel version 2.13.4 and 3.14.x including the fact that Camel 2.25.0 reached it's EOL (end of life) in January 2022 meaning that it will no longer receive updates.
Your options are either to upgrade your integration to more recent camel version or implement a custom processor or camel-component that does what you do with camel-saxon in your integration but by using more recent versions of saxon related libraries.