messageProperties.setContentType(MessageProperties.CONTENT_TYPE_JSON);
messageProperties.setContentEncoding(this.encoding);
messageProperties.setContentLength(body != null ? body.length : 0);
classMapper.fromClass(object.getClass(), messageProperties);
return new Message(body, messageProperties);
} catch (XMLStreamException ex) {
String typeId = (String) messageProperties.getHeaders().get(DefaultClassMapper.DEFAULT_CLASSID_FIELD_NAME);
LOG.error("XMLStreamException trying to marshal message of type {}", typeId, ex);
throw new MessageConversionException("Could not marshal message of type "+typeId, ex);
} catch (XStreamException ex) {