camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <sberyoz...@gmail.com>
Subject Re: onException issues with cxfrs
Date Fri, 11 Apr 2014 11:42:46 GMT

Hi,
It is interesting that related issues often reported simultaneously :-)

FYI, Willem has just helped to fix the issue where JAX-RS exception 
mappers have not been effective in the routes, see more comments below...


On 11/04/14 09:47, bijoy wrote:
> I have following route configuration...
>
> *camel-config.xml*
>
>     <cxf:rsServer id="restServer" address="/"
> serviceClass="sample.ReratingServices2" loggingFeatureEnabled="true" />
>    <camel:camelContext id="sampleContext" autoStartup="true"
> streamCache="true" handleFault="true" >
>          <camel:onException>
>              <camel:exception>java.lang.Exception</camel:exception>
>
> <camel:handled><camel:constant>true</camel:constant></camel:handled>
>              <camel:process ref="faultProcessor"/>
>          </camel:onException>
>
>          <camel:route id="httpRequestHandler" startupOrder="1">
>             <camel:from
> uri="cxfrs://bean://restServer?bindingStyle=SimpleConsumer"/>
>             <camel:process ref="updateSession"/>
>             <camel:process ref="validateRequest"/>
>         </camel:route>
>   </camel:camelContext>
>
> The problem here is - the exceptions being thrown by the processors are
> being caught by onException but I'm not able to get the Exception object
> using following code...
>                 exception =
> exchange.getIn().getHeader(Exchange.EXCEPTION_CAUGHT,Exception.class);
>
> I tried with *exception = exchange.getException(Exception.class);* setting
> "handled" to false. That did not work too.
>
> Any idea what could be causing the problem.

Is it a core Camel enhancement issue ? I'm not sure it is supposed to 
work after the exceptions have been caught
>
> Also the exceptions being thrown by cxf component are not being caught by
> onException. is there any possibility to catch them within onException.
>
That sounds reasonable to me; using ExceptionMappers makes sense on the 
lower CXF JAX-RS level only for preventing leaking of the exceptions, 
but if it has not been caught then managing at Camel level should work; 
can you please check the archives by the way, I recall there were some 
similar queries awhile back,

Cheers, Sergey


> Regards,
> Bijoy
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/onException-issues-with-cxfrs-tp5750099.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


Mime
View raw message