我试图在Jms队列中读取我已设置为Integer对象的对象消息。我可以通过浏览器http://localhost:8161/admin/queues.jsp查看邮件的“消息详细信息”中的整数值。
当我尝试通过objectMessage.getObject()
获取消息详细信息时,我收到以下错误。
javax.jms.JMSException: Failed to build body from content. Serializable class not available to broker. Reason: java.lang.ClassNotFoundException: Forbidden class java.lang.Integer! This class is not trusted to be serialized as ObjectMessage payload. Please take a look at http://activemq.apache.org/objectmessage.html for more information on how to configure trusted classes.
at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:36)
at org.apache.activemq.command.ActiveMQObjectMessage.getObject(ActiveMQObjectMessage.java:208)
我甚至尝试添加-Dorg.apache.activemq.SERIALIZABLE_PACKAGES=*
作为VM参数,即使包含java.lang
也是如此。没有区别。
感谢任何帮助。