You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Martin Stiborský <ma...@gmail.com> on 2013/07/22 12:01:35 UTC

NPE with splitter, aggregator and JMS - properties and transferExchange option

Hello guys,
I have a route, where List from Exchange body is splitted and each item is
sent to JMS, the main route waits for response, performs some more
transformation and then continue with next item from the list in the same
way.
All the response are aggregated into another list, which is processed once
the splitter get its job done.

In the JMS route, I need to use some Exchange properties, so I used
tranferExchange=true option for both JMS producer and consumer endpoint.

But I have strange problem there, sometime it works, sometimes not and the
NPE exception is raised.
I can't find the wrong point, it seems that the problem is with properties
when transferring the exchange to JMS route.

I broke the code into smaller pieces and wrote some unit tests to locate
the problem.
Here is link to the test, the routes there describes what I'm doing, in
simplified version:
https://gist.github.com/stibi/6052674

Here is the jaxrs service resource class:
https://gist.github.com/stibi/6052697

Could you guys try to run the test?
Or if you spot something completely wrong there, please let me know.

Sometimes the route works, the second test pass green (the first one
without transferring the exchange always pass), but sometimes this
exception occur:
https://gist.github.com/stibi/6052726

I'm running Camel 2.11.0. Maybe it could be related to this issues:
https://issues.apache.org/jira/browse/CAMEL-6218

-- 
S pozdravem / Best regards
Martin Stiborský

Jabber: stibi@njs.netlab.cz
Twitter: http://www.twitter.com/stibi

Re: NPE with splitter, aggregator and JMS - properties and transferExchange option

Posted by Willem jiang <wi...@gmail.com>.
I suggest you clean up the exchange properties before trying to marshall the properties.
From the stack trace, it looks like there are some trouble to marshall the CXF XMLMessage which could be store into the exchange properties.


--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Monday, July 22, 2013 at 6:42 PM, Martin Stiborský wrote:

> Fortunately I can solve the problem with kind of workaround - not passing
> exchange to JMS and use just Exchange headers. That works for me.
> Anyway i'd like to know what is wrong with the transferExchange=true
> solution.
>  
>  
> On Mon, Jul 22, 2013 at 12:01 PM, Martin Stiborský <
> martin.stiborsky@gmail.com (mailto:martin.stiborsky@gmail.com)> wrote:
>  
> > Hello guys,
> > I have a route, where List from Exchange body is splitted and each item is
> > sent to JMS, the main route waits for response, performs some more
> > transformation and then continue with next item from the list in the same
> > way.
> > All the response are aggregated into another list, which is processed once
> > the splitter get its job done.
> >  
> > In the JMS route, I need to use some Exchange properties, so I used
> > tranferExchange=true option for both JMS producer and consumer endpoint.
> >  
> > But I have strange problem there, sometime it works, sometimes not and the
> > NPE exception is raised.
> > I can't find the wrong point, it seems that the problem is with properties
> > when transferring the exchange to JMS route.
> >  
> > I broke the code into smaller pieces and wrote some unit tests to locate
> > the problem.
> > Here is link to the test, the routes there describes what I'm doing, in
> > simplified version:
> > https://gist.github.com/stibi/6052674
> >  
> > Here is the jaxrs service resource class:
> > https://gist.github.com/stibi/6052697
> >  
> > Could you guys try to run the test?
> > Or if you spot something completely wrong there, please let me know.
> >  
> > Sometimes the route works, the second test pass green (the first one
> > without transferring the exchange always pass), but sometimes this
> > exception occur:
> > https://gist.github.com/stibi/6052726
> >  
> > I'm running Camel 2.11.0. Maybe it could be related to this issues:
> > https://issues.apache.org/jira/browse/CAMEL-6218
> >  
> > --
> > S pozdravem / Best regards
> > Martin Stiborský
> >  
> > Jabber: stibi@njs.netlab.cz (mailto:stibi@njs.netlab.cz)
> > Twitter: http://www.twitter.com/stibi
>  
>  
>  
>  
>  
> --  
> S pozdravem / Best regards
> Martin Stiborský
>  
> Jabber: stibi@njs.netlab.cz (mailto:stibi@njs.netlab.cz)
> Twitter: http://www.twitter.com/stibi




Re: NPE with splitter, aggregator and JMS - properties and transferExchange option

Posted by Martin Stiborský <ma...@gmail.com>.
Fortunately I can solve the problem with kind of workaround - not passing
exchange to JMS and use just Exchange headers. That works for me.
Anyway i'd like to know what is wrong with the transferExchange=true
solution.


On Mon, Jul 22, 2013 at 12:01 PM, Martin Stiborský <
martin.stiborsky@gmail.com> wrote:

> Hello guys,
> I have a route, where List from Exchange body is splitted and each item is
> sent to JMS, the main route waits for response, performs some more
> transformation and then continue with next item from the list in the same
> way.
> All the response are aggregated into another list, which is processed once
> the splitter get its job done.
>
> In the JMS route, I need to use some Exchange properties, so I used
> tranferExchange=true option for both JMS producer and consumer endpoint.
>
> But I have strange problem there, sometime it works, sometimes not and the
> NPE exception is raised.
> I can't find the wrong point, it seems that the problem is with properties
> when transferring the exchange to JMS route.
>
> I broke the code into smaller pieces and wrote some unit tests to locate
> the problem.
> Here is link to the test, the routes there describes what I'm doing, in
> simplified version:
> https://gist.github.com/stibi/6052674
>
> Here is the jaxrs service resource class:
> https://gist.github.com/stibi/6052697
>
> Could you guys try to run the test?
> Or if you spot something completely wrong there, please let me know.
>
> Sometimes the route works, the second test pass green (the first one
> without transferring the exchange always pass), but sometimes this
> exception occur:
> https://gist.github.com/stibi/6052726
>
> I'm running Camel 2.11.0. Maybe it could be related to this issues:
> https://issues.apache.org/jira/browse/CAMEL-6218
>
> --
> S pozdravem / Best regards
> Martin Stiborský
>
> Jabber: stibi@njs.netlab.cz
> Twitter: http://www.twitter.com/stibi
>



-- 
S pozdravem / Best regards
Martin Stiborský

Jabber: stibi@njs.netlab.cz
Twitter: http://www.twitter.com/stibi