camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <>
Subject Re: onException issues with cxfrs
Date Wed, 16 Apr 2014 14:39:44 GMT
On 16/04/14 14:14, bijoy wrote:
> Hi Sergey,
> Thanks for your response!
> Somehow onException was not setting the exception object on header. As you
> mentioned it should be a core camel issue. To get the exception object I had
> manually set a header as follows...
> <camel:onException>
>              <camel:exception>java.lang.Exception</camel:exception>
> <camel:handled><camel:constant>true</camel:constant></camel:handled>
>              <camel:log message="The caught exception is:
> ${exception.message}"></camel:log>
>              <camel:setHeader
> headerName="caughtException"><camel:simple>${exception}</camel:simple></camel:setHeader>
>              <camel:process ref="faultProcessor"/>
>          </camel:onException>
Can you open a minor improvement request against the core ? May it will 
be fixed if agreed upon
> Also to catch the exception thrown by CXF I used exception mapper as
> follows...
>    <jaxrs:server id="restServer">
>      <jaxrs:serviceBeans>
>          <ref bean="reratingServices"/>
>      </jaxrs:serviceBeans>
>      <jaxrs:providers>
>          <ref bean="cxfExceptionMapper"/>
>      </jaxrs:providers>
>    </jaxrs:server>
> This works fine.
FYI using exception directly within cxfrs server has also been fixed by 
Willem. Now, as far as your original query is concerned, using Camel 
exception handlers to catch the exceptions escaped from CXFRS, I guess 
it requires a bit of thought:
in JAX-RS, the escaped exceptions, those not matched by exception 
mappers, are supposed to lead to HTTP 500 returned to the original 
client, that said, if we use CXFRS, we are in the Camel world, and may 
be Camel exception  mappers should get a chance to act as 'JAX-RS 
exception mappers', especially if it is possible that a leaked exception 
can break the route with the original client receiving no response at all...
Something that will need to be investigated further, I'll keep an eye on 

> But to use jaxrs component I had to add cxf-bundle-jaxrs in
> my dependencies. Now cxf-bundle-jaxrs contains jetty jars and trying to run
> embedded jetty server on top of my external jetty container. I tried to
> exclude the jetty jars from dependency but it did not help and I was getting
> ServiceConstructionException.
> Any idea how use jaxrs component within external jetty container. The CXF
> doc does not provide much insight on
> that.
I'm not sure why do use this bundle dependency, I guess because you use 
jaxrs:server directly ? If yes and it also has an absolute address URI, 
then Camel transports will by bypassed AFAIK, use the relative address, 
should work OK with Camel servlet, etc

Cheers, Sergey


> Regards,
> Bijoy
> --
> View this message in context:
> Sent from the Camel - Users mailing list archive at

Sergey Beryozkin

Talend Community Coders


View raw message