Reputation: 33
I send a org.springframework.messaging.support.GenericMessage
to a queue in ActiveMQ by org.springframework.jms.core.JmsTemplate
. in ActiveMQ, I see this message :
Cannot display ObjectMessage body. Reason: Failed to build body from content.
Serializable class not available to broker.
Reason: java.lang.ClassNotFoundException: org.springframework.messaging.support.GenericMessage
and so I can't read that message in a client. I set trustAllPackages to true in my activeMQConnectionFactory and problem doesn't solve. How to solve it ?
Upvotes: 0
Views: 5282
Reputation: 337
Simply put:
Add the required jar or class files or the serialised messages in the lib folder of activemq and restart activemq.
It worked for me
Upvotes: 0
Reputation: 174564
The JmsTemplate
will serialize the entire GenericMessage
as a java object, so spring-messaging
is needed on the class path of the receiving system as well.
class not available to broker.
It looks like you might be trying to view the message in the admin UI, which doesn't understand spring-messaging classes.
If you want to map the GenericMessage to a JMS Message instead, use the JmsMessagingTemplate
instead (one of the send()
methods); the broker might be able to display such a message (depending on the payload type).
Upvotes: 1