You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Willem Jiang (JIRA)" <ji...@apache.org> on 2009/05/02 09:08:38 UTC

[jira] Created: (CAMEL-1581) ClassCastException when using camel-cxf and camel-jms in the InOut same flow

 ClassCastException when using camel-cxf and camel-jms in the InOut same flow
-----------------------------------------------------------------------------

                 Key: CAMEL-1581
                 URL: https://issues.apache.org/activemq/browse/CAMEL-1581
             Project: Apache Camel
          Issue Type: Bug
    Affects Versions: 1.6.0, 1.5.0
            Reporter: Willem Jiang
            Assignee: Willem Jiang
             Fix For: 1.6.1


As per thread on FUSE forum http://fusesource.com/forums/thread.jspa?threadID=834&tstart=0:

[[
I have a camel route that listens on a CXFEndpoint (for MESSAGE data as DOMSource) and routes the message to a JMS queue. Something like:

<route>
<from uri="cxf:bean:passportRequestWS?dataFormat=MESSAGE"/>
<to uri="soapProcessor"/>
<convertBodyTo type="java.lang.String"/>
<to uri="activemq:queue:blah"/>
<convertBodyTo type="javax.xml.transform.dom.DOMSource"/>
</route>

My understanding is that the JMS producer will realize that the exchange is InOut, create a temporary queue for the response, and then wait for the response to arrive on the temporary queue before sending the original CXFExchange on along the pipeline. Indeed, this is what I observe! However, I?ve discovered a little nasty.

When the JMSProducer gets in the incoming message, it sets the Out message of the original CXFExchange to a JmsMessage. Then, the pipeline processor calls exchange.getOut on the CXFExchange and BANG! we get a class-cast exception. Turns out that the CXFExchange.getOut() method always casts the message to a CxfMessage. Ouch. Surely this means then that camel-cxf can?t talk to any producer that does not produce a CXFMessage - very limiting.
]]

The response on the form from davsclaus was:

[[
Well spotted.

If just the damn Exchange was final so we had one implementation of it. But I guess we have to thank Java generics for that so the first API had generics for per component.

Could you create a ticket in JIRA for this?

As a workaround you can add a processor where you have full access to the Exchange so you can set a CxfMessage as the payload.
]]

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1581) ClassCastException when using camel-cxf and camel-jms in the InOut same flow

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1581?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=51488#action_51488 ] 

Willem Jiang commented on CAMEL-1581:
-------------------------------------

Fixed the test in camel 1.x branch
 http://svn.apache.org/viewvc?rev=770910&view=rev

>  ClassCastException when using camel-cxf and camel-jms in the InOut same flow
> -----------------------------------------------------------------------------
>
>                 Key: CAMEL-1581
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1581
>             Project: Apache Camel
>          Issue Type: Bug
>    Affects Versions: 1.5.0, 1.6.0
>            Reporter: Willem Jiang
>            Assignee: Willem Jiang
>             Fix For: 1.6.1
>
>
> As per thread on FUSE forum http://fusesource.com/forums/thread.jspa?threadID=834&tstart=0:
> [[
> I have a camel route that listens on a CXFEndpoint (for MESSAGE data as DOMSource) and routes the message to a JMS queue. Something like:
> <route>
> <from uri="cxf:bean:passportRequestWS?dataFormat=MESSAGE"/>
> <to uri="soapProcessor"/>
> <convertBodyTo type="java.lang.String"/>
> <to uri="activemq:queue:blah"/>
> <convertBodyTo type="javax.xml.transform.dom.DOMSource"/>
> </route>
> My understanding is that the JMS producer will realize that the exchange is InOut, create a temporary queue for the response, and then wait for the response to arrive on the temporary queue before sending the original CXFExchange on along the pipeline. Indeed, this is what I observe! However, I?ve discovered a little nasty.
> When the JMSProducer gets in the incoming message, it sets the Out message of the original CXFExchange to a JmsMessage. Then, the pipeline processor calls exchange.getOut on the CXFExchange and BANG! we get a class-cast exception. Turns out that the CXFExchange.getOut() method always casts the message to a CxfMessage. Ouch. Surely this means then that camel-cxf can?t talk to any producer that does not produce a CXFMessage - very limiting.
> ]]
> The response on the form from davsclaus was:
> [[
> Well spotted.
> If just the damn Exchange was final so we had one implementation of it. But I guess we have to thank Java generics for that so the first API had generics for per component.
> Could you create a ticket in JIRA for this?
> As a workaround you can add a processor where you have full access to the Exchange so you can set a CxfMessage as the payload.
> ]]

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1581) ClassCastException when using camel-cxf and camel-jms in the InOut same flow

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1581?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=51482#action_51482 ] 

Willem Jiang commented on CAMEL-1581:
-------------------------------------

Since we removed the CxfMessage and CxfExchange in Camel 2.0,  we will not get into this trouble in Camel 2.0.
I just committed a integration test in the camel-trunk to confirm it. 

>  ClassCastException when using camel-cxf and camel-jms in the InOut same flow
> -----------------------------------------------------------------------------
>
>                 Key: CAMEL-1581
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1581
>             Project: Apache Camel
>          Issue Type: Bug
>    Affects Versions: 1.5.0, 1.6.0
>            Reporter: Willem Jiang
>            Assignee: Willem Jiang
>             Fix For: 1.6.1
>
>
> As per thread on FUSE forum http://fusesource.com/forums/thread.jspa?threadID=834&tstart=0:
> [[
> I have a camel route that listens on a CXFEndpoint (for MESSAGE data as DOMSource) and routes the message to a JMS queue. Something like:
> <route>
> <from uri="cxf:bean:passportRequestWS?dataFormat=MESSAGE"/>
> <to uri="soapProcessor"/>
> <convertBodyTo type="java.lang.String"/>
> <to uri="activemq:queue:blah"/>
> <convertBodyTo type="javax.xml.transform.dom.DOMSource"/>
> </route>
> My understanding is that the JMS producer will realize that the exchange is InOut, create a temporary queue for the response, and then wait for the response to arrive on the temporary queue before sending the original CXFExchange on along the pipeline. Indeed, this is what I observe! However, I?ve discovered a little nasty.
> When the JMSProducer gets in the incoming message, it sets the Out message of the original CXFExchange to a JmsMessage. Then, the pipeline processor calls exchange.getOut on the CXFExchange and BANG! we get a class-cast exception. Turns out that the CXFExchange.getOut() method always casts the message to a CxfMessage. Ouch. Surely this means then that camel-cxf can?t talk to any producer that does not produce a CXFMessage - very limiting.
> ]]
> The response on the form from davsclaus was:
> [[
> Well spotted.
> If just the damn Exchange was final so we had one implementation of it. But I guess we have to thank Java generics for that so the first API had generics for per component.
> Could you create a ticket in JIRA for this?
> As a workaround you can add a processor where you have full access to the Exchange so you can set a CxfMessage as the payload.
> ]]

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CAMEL-1581) ClassCastException when using camel-cxf and camel-jms in the InOut same flow

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-1581?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Willem Jiang resolved CAMEL-1581.
---------------------------------

    Resolution: Fixed

>  ClassCastException when using camel-cxf and camel-jms in the InOut same flow
> -----------------------------------------------------------------------------
>
>                 Key: CAMEL-1581
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1581
>             Project: Apache Camel
>          Issue Type: Bug
>    Affects Versions: 1.5.0, 1.6.0
>            Reporter: Willem Jiang
>            Assignee: Willem Jiang
>             Fix For: 1.6.1
>
>
> As per thread on FUSE forum http://fusesource.com/forums/thread.jspa?threadID=834&tstart=0:
> [[
> I have a camel route that listens on a CXFEndpoint (for MESSAGE data as DOMSource) and routes the message to a JMS queue. Something like:
> <route>
> <from uri="cxf:bean:passportRequestWS?dataFormat=MESSAGE"/>
> <to uri="soapProcessor"/>
> <convertBodyTo type="java.lang.String"/>
> <to uri="activemq:queue:blah"/>
> <convertBodyTo type="javax.xml.transform.dom.DOMSource"/>
> </route>
> My understanding is that the JMS producer will realize that the exchange is InOut, create a temporary queue for the response, and then wait for the response to arrive on the temporary queue before sending the original CXFExchange on along the pipeline. Indeed, this is what I observe! However, I?ve discovered a little nasty.
> When the JMSProducer gets in the incoming message, it sets the Out message of the original CXFExchange to a JmsMessage. Then, the pipeline processor calls exchange.getOut on the CXFExchange and BANG! we get a class-cast exception. Turns out that the CXFExchange.getOut() method always casts the message to a CxfMessage. Ouch. Surely this means then that camel-cxf can?t talk to any producer that does not produce a CXFMessage - very limiting.
> ]]
> The response on the form from davsclaus was:
> [[
> Well spotted.
> If just the damn Exchange was final so we had one implementation of it. But I guess we have to thank Java generics for that so the first API had generics for per component.
> Could you create a ticket in JIRA for this?
> As a workaround you can add a processor where you have full access to the Exchange so you can set a CxfMessage as the payload.
> ]]

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.