You can't use dynamic expressions like ${body}
in the to operation in an endpoint URI. Use recipientList instead if you need to compute a URI dynamically: http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html
Fuse ESB - Apache Camel: Getting NullPointerException while invoking a REST service hosted on an external web container
-
06-03-2022 - |
Question
I am getting a NullPointerException while invoking a REST webservice hosted on Tomcat. The route looks something like:
<route>
<from uri="rabbitmq:exchange:queue"/>
<to uri="http://localhost:8080/rest-webservice/service/execute?message=${body}" /></route>
I have written a custom type convertor which converts the object I read from the rabbitMQ into a String XML. I need to send this as a parameter to the web service.
I used the <log message="message: ${body}" />
after reading from the rabbitMQ and the type convertor successfully converts the object into String.
Caused by: org.apache.camel.TypeConversionException: Error during type conversion from type: java.lang.String to the required type: org.apache.commons.httpclient.methods.RequestEntity with value
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow