title: Apache camel, how to move message from SOAP to JMS
body: <p>I'm learning Apache Camel framework, and try to build simple route where message is received from SOAP endpoint and is put into JMS queue (ActiveMQ).</p>
  
  <p>I have the following route</p>
  
  <pre><code>&lt;route id="cxfToJMSRoute"&gt;
      &lt;from uri="cxf:bean:endpoint" /&gt;
      &lt;log message="test" /&gt;
      &lt;wireTap uri="direct:logInfo" /&gt;
      &lt;to uri="activemq:queue:api" /&gt;
  &lt;/route&gt;
  </code></pre>
  
  <p>And the endpoint and queue are defined as follows</p>
  
  <pre><code>&lt;cxf:cxfEndpoint id="endpoint" address="http://localhost:1010/hello"
          serviceClass="net.webservicex.GlobalWeatherSoap" wsdlURL="META-INF/globalweather.wsdl" /&gt;
  
  &lt;bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent"&gt;
      &lt;property name="brokerURL" value="tcp://127.0.0.1:61616"/&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>However, when I call the endpoint, the other service reading the message queue throws following error</p>
  
  <pre><code>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: Forbidden class org.apache.cxf.message.MessageContentsList! This class is not trusted to be serialized as ObjectMessage payload. Please take a look at http://activemq.apache.org/objectmessage.html for more information on how to configure trusted classes.. Message: ActiveMQObjectMessage {commandId = 8, responseRequired = true, messageId = ID:IT-L-R90HKRNH-64004-1511880368329-1:1:2:1:1, originalDestination = null, originalTransactionId = null, producerId = ID:IT-L-R90HKRNH-64004-1511880368329-1:1:2:1, destination = queue://api, transactionId = null, expiration = 1511880389430, timestamp = 1511880369430, arrival = 0, brokerInTime = 1511880369434, brokerOutTime = 1511880369495, correlationId = Camel-ID-IT-L-R90HKRNH-1511880338904-0-3, replyTo = temp-queue://ID:IT-L-R90HKRNH-64004-1511880368329-1:1:1, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = org.apache.activemq.util.ByteSequence@663a8b1b, marshalledProperties = org.apache.activemq.util.ByteSequence@504b2d9b, dataStructure = null, redeliveryCounter = 0, size = 1640, properties = {SOAPAction=http://www.webserviceX.NET/GetCitiesByCountry, CamelHttpCharacterEncoding=UTF-8, User_HYPHEN_Agent=Apache-HttpClient/4.1.1 (java 1.5), Host=127.0.0.1:1010, operationName=GetCitiesByCountry, operationNamespace=http://www.webserviceX.NET, breadcrumbId=ID-IT-L-R90HKRNH-1511880338904-0-1, Content_HYPHEN_Type=text/xml;charset=UTF-8, CamelHttpMethod=POST, accept_HYPHEN_encoding=gzip,deflate, connection=keep-alive, CamelHttpUri=/hello, CamelHttpPath=}, readOnlyProperties = true, readOnlyBody = true, droppable = false, jmsXGroupFirstForConsumer = false}
          at org.apache.camel.component.jms.JmsBinding.extractBodyFromJms(JmsBinding.java:160) ~[camel-jms-2.16.3.jar!/:2.16.3]
          at org.apache.camel.component.jms.JmsMessage.createBody(JmsMessage.java:236) ~[camel-jms-2.16.3.jar!/:2.16.3]
          at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:54) ~[camel-core-2.20.1.jar!/:2.20.1]
          at org.apache.camel.builder.ExpressionBuilder$35.evaluate(ExpressionBuilder.java:905) ~[camel-core-2.20.1.jar!/:2.20.1]
          at org.apache.camel.support.ExpressionAdapter.evaluate(ExpressionAdapter.java:36) ~[camel-core-2.20.1.jar!/:2.20.1]
          at org.apache.camel.builder.ExpressionBuilder$76.evaluate(ExpressionBuilder.java:1836) ~[camel-core-2.20.1.jar!/:2.20.1]
          at org.apache.camel.support.ExpressionAdapter.evaluate(ExpressionAdapter.java:36) ~[camel-core-2.20.1.jar!/:2.20.1]
          at org.apache.camel.processor.LogProcessor.process(LogProcessor.java:64) ~[camel-core-2.20.1.jar!/:2.20.1]
          at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548) ~[camel-core-2.20.1.jar!/:2.20.1]
          at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201) ~[camel-core-2.20.1.jar!/:2.20.1]
          at org.apache.camel.processor.Pipeline.process(Pipeline.java:138) ~[camel-core-2.20.1.jar!/:2.20.1]
          at org.apache.camel.processor.Pipeline.process(Pipeline.java:101) ~[camel-core-2.20.1.jar!/:2.20.1]
          at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201) ~[camel-core-2.20.1.jar!/:2.20.1]
          at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:97) ~[camel-core-2.20.1.jar!/:2.20.1]
          at org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:112) ~[camel-jms-2.16.3.jar!/:2.16.3]
          at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:719) ~[spring-jms-4.3.12.RELEASE.jar!/:4.3.12.RELEASE]
          at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:679) ~[spring-jms-4.3.12.RELEASE.jar!/:4.3.12.RELEASE]
          at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:649) ~[spring-jms-4.3.12.RELEASE.jar!/:4.3.12.RELEASE]
          at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:317) [spring-jms-4.3.12.RELEASE.jar!/:4.3.12.RELEASE]
          at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:255) [spring-jms-4.3.12.RELEASE.jar!/:4.3.12.RELEASE]
          at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1166) [spring-jms-4.3.12.RELEASE.jar!/:4.3.12.RELEASE]
          at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1158) [spring-jms-4.3.12.RELEASE.jar!/:4.3.12.RELEASE]
          at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1055) [spring-jms-4.3.12.RELEASE.jar!/:4.3.12.RELEASE]
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_92]
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_92]
          at java.lang.Thread.run(Thread.java:745) [na:1.8.0_92]
  Caused by: javax.jms.JMSException: Failed to build body from content. Serializable class not available to broker. Reason: java.lang.ClassNotFoundException: Forbidden class org.apache.cxf.message.MessageContentsList! This class is not trusted to be serialized as ObjectMessage payload. Please take a look at http://activemq.apache.org/objectmessage.html for more information on how to configure trusted classes.
          at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:36) ~[activemq-client-5.14.5.jar!/:5.14.5]
          at org.apache.activemq.command.ActiveMQObjectMessage.getObject(ActiveMQObjectMessage.java:208) ~[activemq-client-5.14.5.jar!/:5.14.5]
          at org.apache.camel.component.jms.JmsBinding.extractBodyFromJms(JmsBinding.java:135) ~[camel-jms-2.16.3.jar!/:2.16.3]
          ... 25 common frames omitted
  Caused by: java.lang.ClassNotFoundException: Forbidden class org.apache.cxf.message.MessageContentsList! This class is not trusted to be serialized as ObjectMessage payload. Please take a look at http://activemq.apache.org/objectmessage.html for more information on how to configure trusted classes.
          at org.apache.activemq.util.ClassLoadingAwareObjectInputStream.checkSecurity(ClassLoadingAwareObjectInputStream.java:112) ~[activemq-client-5.14.5.jar!/:5.14.5]
          at org.apache.activemq.util.ClassLoadingAwareObjectInputStream.resolveClass(ClassLoadingAwareObjectInputStream.java:57) ~[activemq-client-5.14.5.jar!/:5.14.5]
          at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1620) ~[na:1.8.0_92]
          at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1521) ~[na:1.8.0_92]
          at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1781) ~[na:1.8.0_92]
          at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1353) ~[na:1.8.0_92]
          at java.io.ObjectInputStream.readObject(ObjectInputStream.java:373) ~[na:1.8.0_92]
          at org.apache.activemq.command.ActiveMQObjectMessage.getObject(ActiveMQObjectMessage.java:206) ~[activemq-client-5.14.5.jar!/:5.14.5]
          ... 26 common frames omitted
  </code></pre>
  
  <p>So do I have to convert the message to POJO myself before the JMS? I'm completely new to Camel, but I got the impression Camel should handle type conversions automatically.</p>