2011-10-11 26 views
2

我嘗試使用駱駝路由向PHP腳本發送POST消息,只要新的JMS消息到達給定隊列中。我已經得到了該工作,但現在的POST消息缺少JMS消息體,和我得到我的ActiveMQ記錄以下錯誤:Apache Camel:DefaultMessage不能轉換爲JmsMessage

2011-10-10 17:46:39,961 | ERROR | Caused by: [org.apache.camel.RuntimeCamelException - 
java.lang.ClassCastException: org.apache.camel.impl.DefaultMessage cannot be cast to 
org.apache.camel.component.jms.JmsMessage] | 
org.apache.camel.component.jms.EndpointMessageListener | 
DefaultMessageListenerContainer-1 
org.apache.camel.RuntimeCamelException: java.lang.ClassCastException: 
org.apache.camel.impl.DefaultMessage cannot be cast to 
org.apache.camel.component.jms.JmsMessage 

我已經包含在我的POM駱駝JMS依賴.xml文件。我使用的是Camel 2.4.0,並將camel-jms jar文件放在ActiveMQ的lib文件夾中。

這就是我目前的路線是這樣的:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
<route autoStartup="true" inheritErrorHandler="true" id="route2" xmlns:ns2="http://camel.apache.org/schema/web" xmlns="http://camel.apache.org/schema/spring"> 
    <from uri="activemq:topic:topic_name"/> 
    <setBody inheritErrorHandler="true" id="setBody2"> 
     <simple>name=${body}</simple> 
    </setBody> 
    <setHeader headerName="Content-Type" inheritErrorHandler="true" id="setHeader3"> 
     <constant>application/x-www-form-urlencoded;</constant> 
    </setHeader> 
    <setHeader headerName="CamelHttpMethod" inheritErrorHandler="true" id="setHeader4"> 
     <constant>POST</constant> 
    </setHeader> 
    <to uri="http://path/to/process.php" inheritErrorHandler="true" id="to2"/> 
</route> 

我失去了我的路由配置的東西嗎?或者ActiveMQ服務器本身有問題嗎?

+0

是運行此駱駝路由的應用程序的lib目錄中的camel-jms依賴關係嗎?這真的是它需要的地方。 –

回答

0

駱駝在這方面有一個錯誤。您可以通過升級Camel或使用具有更新Camel版本的更新AMQ來解決此問題。

相關問題