Hi

I have created a ticket to fix that class cast exception
https://issues.apache.org/jira/browse/CAMEL-3979

On Tue, May 17, 2011 at 10:46 AM, James Talbut <[email protected]> wrote:
> Hi,
>
> I've got the following three routes:
>  <camel:camelContext id="sampleHashCamelContext" >
>    <camel:route>
>      <camel:from uri="cxf:bean:serviceEndpoint" />
>      <camel:transacted />
>      <camel:to uri="activemq:queue:SampleAsyncHashCamelQueue" 
> pattern="InOnly" />
>    </camel:route>
>
>    <camel:route streamCache="true" handleFault="false">
>      <camel:from uri="activemq:queue:SampleAsyncHashCamelQueue" />
>      <camel:transacted />
>      <camel:loadBalance>
>        <camel:roundRobin />
>        <camel:to uri="cxf:bean:targetEndpoint1"/>
>        <camel:to uri="cxf:bean:targetEndpoint2"/>
>        <camel:to uri="cxf:bean:targetEndpoint3"/>
>      </camel:loadBalance>
>      <camel:to uri="activemq:queue:SampleAsyncHashCamelQueueReply" />
>    </camel:route>
>
>    <camel:route>
>      <camel:from uri="activemq:queue:SampleAsyncHashCamelQueueReply" />
>      <camel:transacted />
>      <camel:to uri="http://192.168.1.100:8080/sampleHashCamelContext"; 
> pattern="InOnly" />
>    </camel:route>
>  </camel:camelContext>
>
>
> In the no-error case everything works perfectly, one of the CXF endpoints 
> gets called asynchronously and the results get sent to an http endpoint.
>
> To test the error handling I change the CXF endpoints to point to TCP ports 
> that aren't listening.
> When I do this for one endpoint everything continues to work correctly.
> When I change two endpoints I get the following error:
> Interceptor for 
> {http://spudsoft.co.uk/}Hash#{http://spudsoft.co.uk/}HashFiles has thrown 
> exception, unwinding now
> org.apache.cxf.interceptor.Fault: org.apache.camel.impl.DefaultMessage cannot 
> be cast to org.apache.camel.component.jms.JmsMessage
>        at 
> org.apache.camel.component.cxf.CxfConsumer$1.checkFailure(CxfConsumer.java:218)[136:org.apache.camel.camel-cxf:2.7.1]
>        ...
> Caused by: java.lang.ClassCastException: org.apache.camel.impl.DefaultMessage 
> cannot be cast to org.apache.camel.component.jms.JmsMessage
>        at 
> org.apache.camel.component.jms.JmsProducer.setMessageId(JmsProducer.java:365)[155:org.apache.camel.camel-jms:2.7.1]
>        ...
>
> In the docs for transactional-client there is an example of a similar route 
> that has to explicitly create a new transaction for the second stage.
> Should I be doing this?
> If so, how does camel know that it should wrap the three routes in a single 
> transaction (i.e. if something else were to dequeue messages wouldn't that 
> leave the
> transaction hanging?)
>
> If I don't need to explicitly declare transaction policies, what is causing 
> the error?
>
> Thanks.
>
> Jim
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: [email protected]
Web: http://fusesource.com
CamelOne 2011: http://fusesource.com/camelone2011/
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Reply via email to