The exception is null because you use handled(true). If you want to get the caused exception, then its stored as a property on the exchange.
Exception cause = exchange.getProperty(Exchange.CAUGHT_EXCEPTION, Exception.class); On Tue, Aug 14, 2012 at 4:35 PM, Hilde <hilde.sch...@yahoo.de> wrote: > Hello Readers! > > Inside the route combined with the DefaultErrorHandler we are using > exception policies. > When an exception is thrown that part is even called but the exception > object is null: > > .onException(Exception.class).handled(true) > .process(new Processor() { > @Override > public void process(Exchange exchange) throws Exception { > exchange.getIn().setBody(exchange.getException()); // why > exception is > null ??? > } > }) > .to("activemq:queue:" + JmsDestinations.QUEUE_LOG_SERVICE) > .end() > > On the other side the jms consumer is used to take the exchange and finally > logs the stack trace via > camel log component: > > from("activemq:queue:" + > JmsDestinations.QUEUE_LOG_SERVICE).routeId("logServiceRoute") > > .to("log:errorLog?level=ERROR&showAll=true&multiline=true&showStackTrace=true"); > > What is the right way to log the stack trace into the log file by the camel > log component? But > take into account that JMS is in use. > > We are using version 2.10.0 . > > Cheers > Hilde > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Exception-in-Exchange-is-null-tp5717324.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen