I am quoting some lines from the ProgrammersGuide - Might help U. -
More complex content may be added through the add method, which supports named Objects. Names must be unique on behalf of a given Message or an appropriate exception will be thrown. Using <name, Object> pairs allows for a finer granularity of data access. The type of Objects that can be added to the Body can be arbitrary: they do not need to be Java Serializable. However, in the case where non-Serializable Objects are added, it is necessary to provide JBossESB with the ability to marshal/unmarshal the Message when it flows across the network.
See the section of Message Formats for more details.
Note:Caution: we discourage the general use of Serialized Java objects in
messages because it constrains the service implementations. Use with
In general you will find it easier to work with the Message Body through the namedObject approach. You can add, remove and inspect individual data items within the Message payload without having to decode the entire Body. Furthermore, you can combine named Objects within the payload with the byte array.
Thank you Ashish
The problem was because the javabean which I was trying to add to the message payload didn implement the Serializable interface.
Now I have changed the javabean to implement Serializable interface and it works fine.