<bean id="targetConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">  
        <property name="brokerURL" value="tcp://localhost:61616"/>
        <!-- 如果传输的对象是Obeject 这里必须加上这句  否则会导致对象序列化失败 出现classnotfound异常  详细: http://activemq.apache.org/objectmessage.html -->
        <property name="trustAllPackages" value="true"/>
    </bean>  

在消费者接受队消息时,出现异常

javax.jms.JMSException: Failed to build body from content. Serializable class not available to broker. Reason: java.lang.ClassNotFoundException: Forbidden class com.guesslive.admin.common.mail.Mail! 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.

然后根据提供的地址找了下原因,在 ActiveMQConnectionFactory 中加入参数 

<property name="trustAllPackages" value="true"/>

问题解决!

相关文章:

  • 2021-05-30
  • 2021-10-20
  • 2021-05-24
  • 2021-05-01
  • 2021-10-21
  • 2022-12-23
  • 2021-12-29
  • 2022-12-23
猜你喜欢
  • 2021-11-18
  • 2021-09-11
  • 2021-11-04
  • 2021-07-02
  • 2021-10-08
  • 2021-08-04
  • 2022-02-27
相关资源
相似解决方案