Why is the exception null when I use onException?

Solution Verified - Updated -

Issue

Why is the exception null when I use onException?

camel route

    <bean class="org.mycompany.MyBean" id="demo"/>
    <camelContext id="cbr-example-context" xmlns="http://camel.apache.org/schema/blueprint">
        <onException>
            <exception>java.lang.IllegalArgumentException</exception>
            <bean method="process" ref="demo"/>
        </onException>
        <route id="cbr-route">
            <from id="route-timer" uri="timer://foo?repeatCount=1"/>
            <setBody id="route-setBody">
                <simple>Hello World from camel-context.xml</simple>
            </setBody>
            <log id="route-log" message=">>> ${body}"/>
            <throwException
                exceptionType="java.lang.IllegalArgumentException"
                id="bugComponent" message="hit the bug"/>
        </route>

Bean

    @Override
    public void process(Exchange exchange) throws Exception {
        Exception exception = exchange.getException();

Environment

  • Red Hat Fuse
    • 7.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content