码迷,mamicode.com
首页 > 编程语言 > 详细

解决Spring集成Activemq使用ObjectMessage报错

时间:2018-02-20 14:22:40      阅读:354      评论:0      收藏:0      [点我收藏+]

标签:class   ted   ref   网址   序列   otf   apach   orb   dex   

**Exception in thread "main" org.springframework.jms.UncategorizedJmsException: Uncategorized exception occured during JMS processing; nested exception is javax.jms.JMSException: Failed to build body from content. Serializable class not available to broker. Reason: java.lang.ClassNotFoundException: Forbidden class SpringActivemq.ActivemqTest.Person! This class is not trusted to be serialized as ObjectMessage payload.

*原因:是ActiveMQ的ObjectMessage依赖于Java的序列化和反序列化,但是这个过程被认为是不安全的。具体信息查看网址:
Please take a look at http://activemq.apache.org/objectmessage.html for more information on how to configure trusted classes.

解决方法:
<bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL">
<value>tcp://198.201.51.131:61616</value>
</property>
<!-- 添加信任包在到trustAllPackages -->
<property name="trustAllPackages" value="true"/> **

<property name="userName">
<value>admin</value>
</property>
<property name="password">
<value>admin</value>
</property>
</bean>

解决Spring集成Activemq使用ObjectMessage报错

标签:class   ted   ref   网址   序列   otf   apach   orb   dex   

原文地址:http://blog.51cto.com/59465168/2071952

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!