Camel Jaxb has a FallbackTypeConverter which will check if the message body object class has the XmlRootElement annotation , then it decide to do the marshal/ unmarshal job or not.

In this case , you don't need to specify data format or use the marshal/unmarshal DSL.

If camel can't convert the object with the common converter, the fall back type converter will be use. So my question is what's the message body object are you using for routing.

On 11/25/10 2:01 AM, enalposi wrote:

Hi.

We are planning to plug JAXB marshalling into our Camel routes.
To start with I annotated DTOs for JAXB and create a schema for .NET
clients. Next was to get Camel involved.

However, simply adding the Maven dependency is causing the unit tests to
throw execptions as below.

Again - marshal/unmarshal (or in fact anything camel-jaxb besides the maven
dependency) has not been added yet and the test runs fine without the
camel-jaxb in the pom. It looks like Camel is autonomously deciding to
marshal stuff once it recognizes JAXB annotations on payloads.

Any idea?

Thanks!

  dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-jaxb</artifactId>
        <version>${apache.camel.version}</version>  (it's 2.4.0)
</dependency>


2010-11-24 12:40:06,647 | DEBUG | org.apache.camel.processor.SendProcessor |
oInAsyncProducer | esb_status_topic |>>>>
Endpoint[bean://statusListener?method=notify] Exchange[Message:
EsbMessage[id=7f053c56-f938-460b-b4d3-65e27764a32b,service=test_service,type=vm:esb_status_topic,version=1,timestamp=2010-11-24T12:40:06-0500,origin=10.0.2.15,payload=Status]]
2010-11-24 12:40:06,647 | DEBUG | ache.camel.processor.DefaultErrorHandler |
log              | esb_status_topic | Failed delivery for exchangeId:
3ac16771-4cac-43ea-9e98-3f9703e351b4. On delivery attempt: 0 caught:
org.apache.camel.CamelExecutionException: Exception occurred during
execution on the exchange: Exchange[Message: EsbMessage[id=7f053c56-f938-460
b-b4d3-65e27764a32b,service=test_service,type=vm:esb_status_topic,version=1,timestamp=2010-11-24T12:40:06-0500,origin=10.0.2.15,payload=Status]]
2010-11-24 12:40:06,647 | ERROR | ache.camel.processor.DefaultErrorHandler |
log              | esb_status_topic | Failed delivery for exchangeId:
3ac16771-4cac-43ea-9e98-3f9703e351b4. Exhausted after delivery attempt: 1
caught: org.apache.camel.CamelExecutionException: Exception occurred during
execution on the exchange: Exchange[Message: EsbMessage[id=7f05
3c56-f938-460b-b4d3-65e27764a32b,service=test_service,type=vm:esb_status_topic,version=1,timestamp=2010-11-24T12:40:06-0500,origin=10.0.2.15,payload=Status]]
org.apache.camel.CamelExecutionException: Exception occurred during
execution on the exchange: Exchange[Message:
EsbMessage[id=7f053c56-f938-460b-b4d3-65e27764a32b,service=test_service,type=vm:esb_status_topic,version=1,timestamp=2010-11-24T12:40:06-0500,origin=10.0.2.15,payload=Status]]
         at
org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1142)
         at
org.apache.camel.converter.jaxb.FallbackTypeConverter.convertTo(FallbackTypeConverter.java:93)
         at
org.apache.camel.impl.converter.DefaultTypeConverter.doConvertTo(DefaultTypeConverter.java:176)
         at
org.apache.camel.impl.converter.DefaultTypeConverter.convertTo(DefaultTypeConverter.java:94)
         at
org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:74)
         at
org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:48)
         at
org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:107)
         at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:91)
         at
org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:74)
         at
org.apache.camel.impl.ProcessorEndpoint.onExchange(ProcessorEndpoint.java:95)
         at
org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:65)
         at
org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:50)


--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
         http://jnn.javaeye.com (Chinese)
Twitter: willemjiang

Reply via email to