You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by metatech <me...@gmail.com> on 2015/09/03 09:09:27 UTC

Camel-SJMS cannot convert Jetty objects to JMS object

Hello,

I tried to use the Camel-SJMS component in Camel 2.14.3 (ServiceMix 5.4.1).
It works nearly completely with the default configuration, both for
producers and consumers : this relatively new component seems to be already
quite mature !
I had only one problem : when the route is "from" a Jetty endpoint, 2
headers (CamelHttpServletRequest and CamelHttpServletResponse) cannot be
serialized by ActiveMQ and this is throwing an IllegalHeaderException.

The workaround is to remove these headers as below :

        <route id="SJMS_Example">
            <from uri="jetty:http://localhost:8888/asyncRoute"/>
	    <removeHeader headerName="CamelHttpServletRequest"/>
	    <removeHeader headerName="CamelHttpServletResponse"/>
            <to uri="sjms:queue:myQueue?exchangePattern=InOnly" />            
        </route>

It would be nice if the Camel-SJMS would handle this case, as the Camel-JMS
component does.

Thanks in advance,
metatech


Caused by: org.apache.camel.component.sjms.jms.IllegalHeaderException:
Failed to set the header CamelHttpServletRequest header. Cause: Only
objectified primitive objects, String, Map and List types are allowed but
was: (GET /asyncRoute)@327121663 org.eclipse.jetty.server.Request@137f7aff
type: class org.eclipse.jetty.server.Request
        at
org.apache.camel.component.sjms.jms.JmsMessageHelper.setJmsMessageHeaders(JmsMessageHelper.java:254)
        at
org.apache.camel.component.sjms.jms.JmsMessageHelper.createMessage(JmsMessageHelper.java:146)
        at
org.apache.camel.component.sjms.producer.InOnlyProducer.sendMessage(InOnlyProducer.java:113)
        ... 57 more
Caused by: javax.jms.MessageFormatException: Only objectified primitive
objects, String, Map and List types are allowed but was: (GET
/asyncRoute)@327121663 org.eclipse.jetty.server.Request@137f7aff type: class
org.eclipse.jetty.server.Request
        at
org.apache.activemq.command.ActiveMQMessage.checkValidObject(ActiveMQMessage.java:538)
        at
org.apache.activemq.command.ActiveMQMessage.setObjectProperty(ActiveMQMessage.java:504)
        at
org.apache.activemq.command.ActiveMQMessage.setObjectProperty(ActiveMQMessage.java:488)
        at
org.apache.camel.component.sjms.jms.JmsMessageHelper.setProperty(JmsMessageHelper.java:370)
        at
org.apache.camel.component.sjms.jms.JmsMessageHelper.setJmsMessageHeaders(JmsMessageHelper.java:252)
        ... 59 more





--
View this message in context: http://camel.465427.n5.nabble.com/Camel-SJMS-cannot-convert-Jetty-objects-to-JMS-object-tp5771193.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel-SJMS cannot convert Jetty objects to JMS object

Posted by metatech <me...@gmail.com>.
Hi Claus,

Thanks for the ticket.
You were faster than me !

metatech


Claus Ibsen-2 wrote
> I logged a ticket
> https://issues.apache.org/jira/browse/CAMEL-9116





--
View this message in context: http://camel.465427.n5.nabble.com/Camel-SJMS-cannot-convert-Jetty-objects-to-JMS-object-tp5771193p5771312.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel-SJMS cannot convert Jetty objects to JMS object

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

I logged a ticket
https://issues.apache.org/jira/browse/CAMEL-9116

On Thu, Sep 3, 2015 at 4:58 PM, Claus Ibsen <cl...@gmail.com> wrote:
> Hi
>
> Yeah it should use same algorithm to filter out not supported headers
> automatic like camel-jms. You are welcome to log a JIRA ticket.
>
> On Thu, Sep 3, 2015 at 9:09 AM, metatech <me...@gmail.com> wrote:
>> Hello,
>>
>> I tried to use the Camel-SJMS component in Camel 2.14.3 (ServiceMix 5.4.1).
>> It works nearly completely with the default configuration, both for
>> producers and consumers : this relatively new component seems to be already
>> quite mature !
>> I had only one problem : when the route is "from" a Jetty endpoint, 2
>> headers (CamelHttpServletRequest and CamelHttpServletResponse) cannot be
>> serialized by ActiveMQ and this is throwing an IllegalHeaderException.
>>
>> The workaround is to remove these headers as below :
>>
>>         <route id="SJMS_Example">
>>             <from uri="jetty:http://localhost:8888/asyncRoute"/>
>>             <removeHeader headerName="CamelHttpServletRequest"/>
>>             <removeHeader headerName="CamelHttpServletResponse"/>
>>             <to uri="sjms:queue:myQueue?exchangePattern=InOnly" />
>>         </route>
>>
>> It would be nice if the Camel-SJMS would handle this case, as the Camel-JMS
>> component does.
>>
>> Thanks in advance,
>> metatech
>>
>>
>> Caused by: org.apache.camel.component.sjms.jms.IllegalHeaderException:
>> Failed to set the header CamelHttpServletRequest header. Cause: Only
>> objectified primitive objects, String, Map and List types are allowed but
>> was: (GET /asyncRoute)@327121663 org.eclipse.jetty.server.Request@137f7aff
>> type: class org.eclipse.jetty.server.Request
>>         at
>> org.apache.camel.component.sjms.jms.JmsMessageHelper.setJmsMessageHeaders(JmsMessageHelper.java:254)
>>         at
>> org.apache.camel.component.sjms.jms.JmsMessageHelper.createMessage(JmsMessageHelper.java:146)
>>         at
>> org.apache.camel.component.sjms.producer.InOnlyProducer.sendMessage(InOnlyProducer.java:113)
>>         ... 57 more
>> Caused by: javax.jms.MessageFormatException: Only objectified primitive
>> objects, String, Map and List types are allowed but was: (GET
>> /asyncRoute)@327121663 org.eclipse.jetty.server.Request@137f7aff type: class
>> org.eclipse.jetty.server.Request
>>         at
>> org.apache.activemq.command.ActiveMQMessage.checkValidObject(ActiveMQMessage.java:538)
>>         at
>> org.apache.activemq.command.ActiveMQMessage.setObjectProperty(ActiveMQMessage.java:504)
>>         at
>> org.apache.activemq.command.ActiveMQMessage.setObjectProperty(ActiveMQMessage.java:488)
>>         at
>> org.apache.camel.component.sjms.jms.JmsMessageHelper.setProperty(JmsMessageHelper.java:370)
>>         at
>> org.apache.camel.component.sjms.jms.JmsMessageHelper.setJmsMessageHeaders(JmsMessageHelper.java:252)
>>         ... 59 more
>>
>>
>>
>>
>>
>> --
>> View this message in context: http://camel.465427.n5.nabble.com/Camel-SJMS-cannot-convert-Jetty-objects-to-JMS-object-tp5771193.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2nd edition: http://www.manning.com/ibsen2



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2nd edition: http://www.manning.com/ibsen2

Re: Camel-SJMS cannot convert Jetty objects to JMS object

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Yeah it should use same algorithm to filter out not supported headers
automatic like camel-jms. You are welcome to log a JIRA ticket.

On Thu, Sep 3, 2015 at 9:09 AM, metatech <me...@gmail.com> wrote:
> Hello,
>
> I tried to use the Camel-SJMS component in Camel 2.14.3 (ServiceMix 5.4.1).
> It works nearly completely with the default configuration, both for
> producers and consumers : this relatively new component seems to be already
> quite mature !
> I had only one problem : when the route is "from" a Jetty endpoint, 2
> headers (CamelHttpServletRequest and CamelHttpServletResponse) cannot be
> serialized by ActiveMQ and this is throwing an IllegalHeaderException.
>
> The workaround is to remove these headers as below :
>
>         <route id="SJMS_Example">
>             <from uri="jetty:http://localhost:8888/asyncRoute"/>
>             <removeHeader headerName="CamelHttpServletRequest"/>
>             <removeHeader headerName="CamelHttpServletResponse"/>
>             <to uri="sjms:queue:myQueue?exchangePattern=InOnly" />
>         </route>
>
> It would be nice if the Camel-SJMS would handle this case, as the Camel-JMS
> component does.
>
> Thanks in advance,
> metatech
>
>
> Caused by: org.apache.camel.component.sjms.jms.IllegalHeaderException:
> Failed to set the header CamelHttpServletRequest header. Cause: Only
> objectified primitive objects, String, Map and List types are allowed but
> was: (GET /asyncRoute)@327121663 org.eclipse.jetty.server.Request@137f7aff
> type: class org.eclipse.jetty.server.Request
>         at
> org.apache.camel.component.sjms.jms.JmsMessageHelper.setJmsMessageHeaders(JmsMessageHelper.java:254)
>         at
> org.apache.camel.component.sjms.jms.JmsMessageHelper.createMessage(JmsMessageHelper.java:146)
>         at
> org.apache.camel.component.sjms.producer.InOnlyProducer.sendMessage(InOnlyProducer.java:113)
>         ... 57 more
> Caused by: javax.jms.MessageFormatException: Only objectified primitive
> objects, String, Map and List types are allowed but was: (GET
> /asyncRoute)@327121663 org.eclipse.jetty.server.Request@137f7aff type: class
> org.eclipse.jetty.server.Request
>         at
> org.apache.activemq.command.ActiveMQMessage.checkValidObject(ActiveMQMessage.java:538)
>         at
> org.apache.activemq.command.ActiveMQMessage.setObjectProperty(ActiveMQMessage.java:504)
>         at
> org.apache.activemq.command.ActiveMQMessage.setObjectProperty(ActiveMQMessage.java:488)
>         at
> org.apache.camel.component.sjms.jms.JmsMessageHelper.setProperty(JmsMessageHelper.java:370)
>         at
> org.apache.camel.component.sjms.jms.JmsMessageHelper.setJmsMessageHeaders(JmsMessageHelper.java:252)
>         ... 59 more
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-SJMS-cannot-convert-Jetty-objects-to-JMS-object-tp5771193.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2nd edition: http://www.manning.com/ibsen2