【问题标题】:Fuse ESB - Apache Camel: Getting NullPointerException while invoking a REST service hosted on an external web containerFuse ESB - Apache Camel:调用托管在外部 Web 容器上的 REST 服务时出现 NullPointerException
【发布时间】:2013-02-01 02:41:23
【问题描述】:

我在调用托管在 Tomcat 上的 REST Web 服务时收到 NullPointerException。路线看起来像:

    <route>
        <from uri="rabbitmq:exchange:queue"/>
    <to uri="http://localhost:8080/rest-webservice/service/execute?message=${body}" /></route>

我编写了一个自定义类型转换器,它将我从 rabbitMQ 读取的对象转换为 String XML。我需要将此作为参数发送到 Web 服务。

我从rabbitMQ读取后使用&amp;lt;log message="message: ${body}" /&amp;gt;,类型转换器成功将对象转换为字符串。

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

【问题讨论】:

    标签: http apache-camel endpoint fuseesb


    【解决方案1】:

    您不能在端点 URI 的 to 操作中使用像 ${body} 这样的动态表达式。如果您需要动态计算 URI,请改用 recipientListhttp://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-03-30
      • 2018-02-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多