Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
4.4.0
-
None
-
Unknown
Description
The following route fails to evaluate the xpath:
from("direct:hello") .routeId("xpath-route") .setBody(xpath("//hello/id", Integer.class)) .to("direct:goodbye");
There seems to be an issue with the instance of QName used. I think it should be XPathConstants.NODESET but instead it is a custom instance with nulled namespace field.
Full project example: https://github.com/alex-nt/issues-java/tree/main/camel/camel-xpath
Running mvn clean install in the module should reproduce the issue.
Error
org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[D855A498421B27E-0000000000000000] at org.apache.camel.CamelExecutionException.wrapCamelExecutionException(CamelExecutionException.java:45) at org.apache.camel.support.ExchangeHelper.extractResultBody(ExchangeHelper.java:676) at org.apache.camel.impl.engine.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:591) at org.apache.camel.impl.engine.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:587) at org.apache.camel.impl.engine.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:189) at org.apache.camel.impl.engine.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:195) at com.example.issues.camel.xpath.AppTest.sendXml(AppTest.java:24) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) Caused by: java.lang.IllegalArgumentException: UnSupported Return Type : NODESET at java.xml/com.sun.org.apache.xpath.internal.jaxp.XPathImplUtil.isSupported(XPathImplUtil.java:252) at java.xml/com.sun.org.apache.xpath.internal.jaxp.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:87) at org.apache.camel.language.xpath.XPathBuilder.doInEvaluateAs(XPathBuilder.java:1022) at org.apache.camel.language.xpath.XPathBuilder.evaluateAs(XPathBuilder.java:910) at org.apache.camel.language.xpath.XPathBuilder.evaluate(XPathBuilder.java:877) at org.apache.camel.language.xpath.XPathBuilder.evaluate(XPathBuilder.java:202) at org.apache.camel.support.builder.ExpressionBuilder$46.evaluate(ExpressionBuilder.java:1546) at org.apache.camel.support.ExpressionAdapter.evaluate(ExpressionAdapter.java:45) at org.apache.camel.processor.SetBodyProcessor.process(SetBodyProcessor.java:45) at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$SimpleTask.handleFirst(RedeliveryErrorHandler.java:462) at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$SimpleTask.run(RedeliveryErrorHandler.java:438) at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.doRun(DefaultReactiveExecutor.java:199) at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.executeReactiveWork(DefaultReactiveExecutor.java:189) at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.tryExecuteReactiveWork(DefaultReactiveExecutor.java:166) at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:148) at org.apache.camel.impl.engine.DefaultReactiveExecutor.scheduleMain(DefaultReactiveExecutor.java:59) at org.apache.camel.processor.Pipeline.process(Pipeline.java:163) at org.apache.camel.impl.engine.CamelInternalProcessor.processNonTransacted(CamelInternalProcessor.java:354) at org.apache.camel.impl.engine.CamelInternalProcessor.process(CamelInternalProcessor.java:330) at org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:96) at org.apache.camel.impl.engine.SharedCamelInternalProcessor.processNonTransacted(SharedCamelInternalProcessor.java:199) at org.apache.camel.impl.engine.SharedCamelInternalProcessor.process(SharedCamelInternalProcessor.java:173) at org.apache.camel.impl.engine.SharedCamelInternalProcessor$1.process(SharedCamelInternalProcessor.java:109) at org.apache.camel.impl.engine.DefaultAsyncProcessorAwaitManager.process(DefaultAsyncProcessorAwaitManager.java:82) at org.apache.camel.impl.engine.SharedCamelInternalProcessor.process(SharedCamelInternalProcessor.java:106) at org.apache.camel.support.cache.DefaultProducerCache.send(DefaultProducerCache.java:178) at org.apache.camel.impl.engine.DefaultProducerTemplate.send(DefaultProducerTemplate.java:176) at org.apache.camel.impl.engine.DefaultProducerTemplate.send(DefaultProducerTemplate.java:172) at org.apache.camel.impl.engine.DefaultProducerTemplate.send(DefaultProducerTemplate.java:153) at org.apache.camel.impl.engine.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:187) ... 5 more
Error SAXON
org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[ACF3176A861BA1E-0000000000000000]
at org.apache.camel.CamelExecutionException.wrapCamelExecutionException(CamelExecutionException.java:45)
at org.apache.camel.support.ExchangeHelper.extractResultBody(ExchangeHelper.java:676)
at org.apache.camel.impl.engine.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:591)
at org.apache.camel.impl.engine.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:587)
at org.apache.camel.impl.engine.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:189)
at org.apache.camel.impl.engine.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:195)
at com.example.issues.camel.xpath.AppTest.sendXml(AppTest.java:24)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
Caused by: java.lang.IllegalArgumentException: qName: Unknown type for expected result
at net.sf.saxon.xpath.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:230)
at org.apache.camel.language.xpath.XPathBuilder.doInEvaluateAs(XPathBuilder.java:1022)
at org.apache.camel.language.xpath.XPathBuilder.evaluateAs(XPathBuilder.java:910)
at org.apache.camel.language.xpath.XPathBuilder.evaluate(XPathBuilder.java:877)
at org.apache.camel.language.xpath.XPathBuilder.evaluate(XPathBuilder.java:202)
at org.apache.camel.support.builder.ExpressionBuilder$46.evaluate(ExpressionBuilder.java:1546)
at org.apache.camel.support.ExpressionAdapter.evaluate(ExpressionAdapter.java:45)
at org.apache.camel.processor.SetBodyProcessor.process(SetBodyProcessor.java:45)
at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$SimpleTask.handleFirst(RedeliveryErrorHandler.java:462)
at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$SimpleTask.run(RedeliveryErrorHandler.java:438)
at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.doRun(DefaultReactiveExecutor.java:199)
at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.executeReactiveWork(DefaultReactiveExecutor.java:189)
at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.tryExecuteReactiveWork(DefaultReactiveExecutor.java:166)
at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:148)
at org.apache.camel.impl.engine.DefaultReactiveExecutor.scheduleMain(DefaultReactiveExecutor.java:59)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:163)
at org.apache.camel.impl.engine.CamelInternalProcessor.processNonTransacted(CamelInternalProcessor.java:354)
at org.apache.camel.impl.engine.CamelInternalProcessor.process(CamelInternalProcessor.java:330)
at org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:96)
at org.apache.camel.impl.engine.SharedCamelInternalProcessor.processNonTransacted(SharedCamelInternalProcessor.java:199)
at org.apache.camel.impl.engine.SharedCamelInternalProcessor.process(SharedCamelInternalProcessor.java:173)
at org.apache.camel.impl.engine.SharedCamelInternalProcessor$1.process(SharedCamelInternalProcessor.java:109)
at org.apache.camel.impl.engine.DefaultAsyncProcessorAwaitManager.process(DefaultAsyncProcessorAwaitManager.java:82)
at org.apache.camel.impl.engine.SharedCamelInternalProcessor.process(SharedCamelInternalProcessor.java:106)
at org.apache.camel.support.cache.DefaultProducerCache.send(DefaultProducerCache.java:178)
at org.apache.camel.impl.engine.DefaultProducerTemplate.send(DefaultProducerTemplate.java:176)
at org.apache.camel.impl.engine.DefaultProducerTemplate.send(DefaultProducerTemplate.java:172)
at org.apache.camel.impl.engine.DefaultProducerTemplate.send(DefaultProducerTemplate.java:153)
at org.apache.camel.impl.engine.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:187)
... 5 more
Attachments
Issue Links
- links to