Why is the exception null when I use onException?

If you use onException to handle exceptions, such as shown below:

Then make notice that because you use handled(true), then the caused exception is no longer available from exchange.getException(), because we told Camel that we will handle the exception.

Instead you can access the caused exception from a property on the exchange with the key Exchange.EXCEPTION_CAUGT, as shown below:

© 2004-2014 The Apache Software Foundation.
Apache Camel, Camel, Apache, the Apache feather logo, and the Apache Camel project logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.
Graphic Design By Hiram