You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by enalposi <en...@yahoo.com> on 2010/11/24 19:01:22 UTC
JAXB causing Unit Test Failure without any actual marshalling
active
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)
--
View this message in context: http://camel.465427.n5.nabble.com/JAXB-causing-Unit-Test-Failure-without-any-actual-marshalling-active-tp3278807p3278807.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: JAXB causing Unit Test Failure without any actual marshalling
active
Posted by enalposi <en...@yahoo.com>.
>
from(source).process(myInProcessor).to(destination).process(myOutProcessor).
Ah, this works. Very nice. Thanks!
--
View this message in context: http://camel.465427.n5.nabble.com/JAXB-causing-Unit-Test-Failure-without-any-actual-marshalling-active-tp3278807p3286117.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: JAXB causing Unit Test Failure without any actual marshalling
active
Posted by Willem Jiang <wi...@gmail.com>.
On 11/29/10 11:14 AM, enalposi wrote:
>
> Willem - I should upgrade to 2.5 first and see if I can reproduce but it's
> not as straight forward as hoped I am afraid.
> Btw - I am defining the routes programmatically at startup time such as -
>
> ...
> RouteBuilder.... {
> public void configure() {
> from(source).process(myProcessor).to(destination);
> }
>
> It all works fine on pub/sub scenarios. But on synchronous request/response
> the processor is called only on the inbound route but not outbound returning
> the response. I suppose with JMS messaging, the response is sent on a temp
> queue, which actually doesn't have a route with this processor defined.
No, it doesn't relate to the JMS message.
>
> How do I get the processor to process bidirectionally?
The processor can just take care one way message. If you want to deal
with the response message, you can add another processor like this
from(source).process(myInProcessor).to(destination).process(myOutProcessor).
>
> Cheers.
--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Re: JAXB causing Unit Test Failure without any actual marshalling
active
Posted by enalposi <en...@yahoo.com>.
Willem - I should upgrade to 2.5 first and see if I can reproduce but it's
not as straight forward as hoped I am afraid.
Btw - I am defining the routes programmatically at startup time such as -
...
RouteBuilder.... {
public void configure() {
from(source).process(myProcessor).to(destination);
}
It all works fine on pub/sub scenarios. But on synchronous request/response
the processor is called only on the inbound route but not outbound returning
the response. I suppose with JMS messaging, the response is sent on a temp
queue, which actually doesn't have a route with this processor defined.
How do I get the processor to process bidirectionally?
Cheers.
--
View this message in context: http://camel.465427.n5.nabble.com/JAXB-causing-Unit-Test-Failure-without-any-actual-marshalling-active-tp3278807p3284642.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: JAXB causing Unit Test Failure without any actual marshalling
active
Posted by Willem Jiang <wi...@gmail.com>.
Can you create a JIRA and send us a simple test case?
That will be quick for us to fix the issue.
On 11/26/10 9:14 PM, enalposi wrote:
>
> Oh, I wasn't aware 2.5 is out. We are on 2.4 still.
>
> I don't think I'll get to a test project any time soon as I'm currently
> working through holidays to meet deadlines (although having been informed it
> is considered treason to work on Thanksgiving in the US).
>
> The workaround and my preference is a custom JAXB adapter plugged into the
> route as a processor.
--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Re: JAXB causing Unit Test Failure without any actual marshalling
active
Posted by enalposi <en...@yahoo.com>.
Oh, I wasn't aware 2.5 is out. We are on 2.4 still.
I don't think I'll get to a test project any time soon as I'm currently
working through holidays to meet deadlines (although having been informed it
is considered treason to work on Thanksgiving in the US).
The workaround and my preference is a custom JAXB adapter plugged into the
route as a processor.
--
View this message in context: http://camel.465427.n5.nabble.com/JAXB-causing-Unit-Test-Failure-without-any-actual-marshalling-active-tp3278807p3281252.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: JAXB causing Unit Test Failure without any actual marshalling active
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
Can you create a small project and/or unit test and attach the file to
a JIRA ticket?
Then we can take a look at it.
I assume you have tried using the latest release, which is Camel 2.5?
On Thu, Nov 25, 2010 at 3:22 PM, enalposi <en...@yahoo.com> wrote:
>
> @Willem
>
> The payload is a simple JAXB annotated Pojo (In this case a Status message,
> containing some strings and maps).
>
> To recap:
> 1. Unit tests (and actual operation) run fine without maven dependency of
> camel-jaxb.
> 2. Jaxb itself runs fine on the classes. Schema is generated and unit tests
> pass for marshalling.
> 3. Jaxb has not been 'activated' for the route. It's as simple as
> from(jms..).to(bean...).
> 4. The reason why I added Jaxb annotations to the working model is to
> eventually migrate to XML payload on the wire so we can integrate .NET
> clients.
>
> I feel simple inclusion of the camel-jaxb dependency should not alter the
> behavior of the code without explicit configuration. I am not sure why a
> FallbackTypeConfigurator would kick in if regular serialization works just
> fine without the dependency.
> --
> View this message in context: http://camel.465427.n5.nabble.com/JAXB-causing-Unit-Test-Failure-without-any-actual-marshalling-active-tp3278807p3280121.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/
Re: JAXB causing Unit Test Failure without any actual marshalling
active
Posted by enalposi <en...@yahoo.com>.
@Willem
The payload is a simple JAXB annotated Pojo (In this case a Status message,
containing some strings and maps).
To recap:
1. Unit tests (and actual operation) run fine without maven dependency of
camel-jaxb.
2. Jaxb itself runs fine on the classes. Schema is generated and unit tests
pass for marshalling.
3. Jaxb has not been 'activated' for the route. It's as simple as
from(jms..).to(bean...).
4. The reason why I added Jaxb annotations to the working model is to
eventually migrate to XML payload on the wire so we can integrate .NET
clients.
I feel simple inclusion of the camel-jaxb dependency should not alter the
behavior of the code without explicit configuration. I am not sure why a
FallbackTypeConfigurator would kick in if regular serialization works just
fine without the dependency.
--
View this message in context: http://camel.465427.n5.nabble.com/JAXB-causing-Unit-Test-Failure-without-any-actual-marshalling-active-tp3278807p3280121.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: JAXB causing Unit Test Failure without any actual marshalling
active
Posted by Willem Jiang <wi...@gmail.com>.
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
Re: JAXB causing Unit Test Failure without any actual marshalling
active
Posted by enalposi <en...@yahoo.com>.
Thanks for following up. In the meantime I have moved on and created a custom
Processor chained into the route, which provides more flexibility for other
processing.
The rest of the stack trace just went further into the jaxb RI and didn't
seem to provide additional clues why Camel is picking this up. The routes
are simple from(bean).to(jms) and reverse. My theory is still that some
Camel component is latching on to JAXB annotated payload without explicit
configuration but we are too time constrained to dig into it.
--
View this message in context: http://camel.465427.n5.nabble.com/JAXB-causing-Unit-Test-Failure-without-any-actual-marshalling-active-tp3278807p3279154.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: JAXB causing Unit Test Failure without any actual marshalling
active
Posted by Richard Kettelerij <ri...@gmail.com>.
Looks like you didn't post the entire stacktrace (the first part is
missing?). Can you post the entire stacktrace? Also can you post your route
definition?
--
View this message in context: http://camel.465427.n5.nabble.com/JAXB-causing-Unit-Test-Failure-without-any-actual-marshalling-active-tp3278807p3279000.html
Sent from the Camel - Users mailing list archive at Nabble.com.