This problem happens if the provider is a FileSystem (FS Provider). If so, to retrive the message, use something like:
System.out.println("Body: "+ new String( (byte) msg.getBody().get() ) );
BUT, if the provider is a JMS provider, use something like this:
System.out.println("Body: " + new String((String) msg.getBody().get()));
in this last case, if you use the former version, it issues an exception. WHY are the message bodies differente?
The default composer for the filesystem retrieves the contents and stores them in the message as a byte. This can easily be changed however, if you know that the contents are string rather than binary.
The default composer is LocalFileMessageComposer but you can add a property within the fs-listener element to override it.
<fs-listener ...> <property name="composer-class" value="XXX"/> </fs-listener>