Camel message body becomes null when sent to error queue in onException() method.

Solution In Progress - Updated -


I have following camel route:

String destination = "cxf:http://localhost:9090/test?dataFormat=MESSAGE";

        .onException(, Exception.class)
            .log(LoggingLevel.WARN, "Failed to send message ${body}") // body is not null here
            .log(LoggingLevel.WARN, "Sending message to the error queue: ${body}")   // body is null here
        .log(LoggingLevel.INFO, "Sending message ...")
        .setHeader("bridgeDestination", constant(destination))
        .log(LoggingLevel.INFO, "received back: ${body}")

If an exception is thrown, for instance, a ConnectionException due to unavailability of the backend web service, the onException() route will be executed. The first log endpoint:

.log(LoggingLevel.WARN, "Failed to send message ${body}") 

prints out camel exchange IN message body without any problem. However, the second log endpoint:

.log(LoggingLevel.WARN, "Sending message to the error queue: ${body}")

prints out a "Sending message to the error queue: null".

Any reason why the message body becomes a null in this case?


  • JBoss Fuse 6.0

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