Hi See this FAQ http://camel.apache.org/why-is-the-exception-null-when-i-use-onexception.html
On Mon, Aug 10, 2015 at 1:19 PM, Felix Thomas <felix.tho...@gmail.com> wrote: > Hello, > > I tried the Below error Handling using DeadLetterChannel , but > currently I am not getting the exception or error in my processor . I want > to log in DB the message along with the reason it failed , for example JDBC > exception, Null pointer exception , data Validation exception in some > method etc. > > > <bean id="myErrorHandler" > class="org.apache.camel.builder.DeadLetterChannelBuilder"> > <property name="deadLetterUri" value="direct:myErrorRoute"/> > <property name="redeliveryPolicy" > ref="myRedeliveryPolicyConfig"/> > </bean> > > <bean id="myRedeliveryPolicyConfig" > class="org.apache.camel.processor.RedeliveryPolicy"> > <property name="maximumRedeliveries" value="1"/> > <property name="redeliveryDelay" value="5000"/> > <property name="allowRedeliveryWhileStopping" value="false"/> > </bean> > > > <!-- Error Handler Generic one --> > <route customId="false" id="myErrorRoute" xmlns=" > http://camel.apache.org/schema/spring"> > <from uri="direct:myErrorRoute"/> > <process ref="CustomErrorProcessor"/> > <to uri="mock:end"/> > </route> > > In the Error Processor is called proper on Exception, But I dont get an > Exception from exchange object nor Fault from the message object. > > i tried the below flags too. exchange.isFailed() and message.isFault() > but returned false. While in the Logs I can see the exception printed > > 2015-08-10 12:19:19,218 [read #8 - Split] DEBUG > DeadLetterChannel - Failed delivery for (MessageId: > ID-DEACR002901-62175-1439201946611-0-1 on ExchangeId: > ID-DEACR002901-62175-1439201946611-0-10). On delivery attempt: 0 caught: > java.lang.NullPointerException > > Failed delivery for (MessageId: ID-DEACR002901-62175-1439201946611-0-1 on > ExchangeId: ID-DEACR002901-62175-1439201946611-0-14). On delivery attempt: > 1 caught: java.lang.NullPointerException > > > How do I get the Origin of the exception in my errorprocessor. > > > regards, > Felix T -- Claus Ibsen ----------------- http://davsclaus.com @davsclaus Camel in Action 2nd edition: http://www.manning.com/ibsen2