0
votes

I'm running Camel embedded in ActiveQM 5.11.1. I have some Java serialized messages that I need to move between queues with a simple Camel route...

    <route>
        <from uri="activemq:A"/>
        <to uri="activemq:B"/>
    </route>     

as expected, I get this error...

WARN | Execution of JMS message listener failed. Caused by: [org.apache.camel.RuntimeCamelException - Failed to extract body due to: javax.jms.JMSException: Failed to build body from content. Serializable class not available to broker. Reason: java.lang.ClassNotFoundException: com.test.MyMessage. Message: ActiveMQObjectMessage

I know this is because Camel/AMQ doesn't know about MyMessage and I can add it to AMQ's classpath to get around this...but that isn't an option in my case.

Instead, can I just tell Camel/AMQ to not try to deserialize it and just move it? I tried the jmsMessageType options, but they didn't get around this error...

1
Try with mapJmsMessage=false - Claus Ibsen
that Claus...I get this warning in the logs " WARN | Cannot determine specific JmsMessage type to use from body class. Will use generic JmsMessage. Body class: org.apache.activemq.command.ActiveMQObjectMessage. If you want to send a POJO then your class might need to implement java.io.Serializable, or you can force a specific type by setting the jmsMessageType option on the JMS endpoint." but it did move the messages... - Ben ODay
@Claus - add that as an answer and I'll give you full credit ;) - Ben ODay
Ah to get rid of the warn you can try to set jmsMessageType=Object - Claus Ibsen

1 Answers

1
votes

You can turn of mapping from JMS to Camel Message using the mapJmsMessage=false option.

And then set jmsMessageType=Object so when sending to the queue, Camel will not try to guess the message type, but use object as configured, then the message is sent as-is.