Message body null for Camel REST/post endpoint

Solution Verified - Updated -

Issue

When posting JSON to a Camel Rest endpoint, attempting to retrieve an object from the Message results in a null object:

        Message msg = (Message) exchange.getIn();
        if(msg != null) {
            MyTest testObj = msg.getBody(MyTest.class);
            if(testObj == null) {
                logger.warn("my test object was null!");
            }
        }

Environment

  • Red Hat Jboss Fuse
    • 6.x
  • Camel
    • 2.15.1

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.