使用activeMq报错:
Caused by: org.springframework.jms.support.converter.MessageConversionException: Could not convert JMS message; nested exception is javax.jms.JMSException: Failed to build body from content. Serializable class not available to broker. Reason: java.lang.ClassNotFoundException: Forbidden class java.util.ArrayList! 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.
在application.properties文件中添加spring.activemq.packages.trust-all=true可以解决这个报错
在application.yml中:
server:
port: 80
spring:
activemq:
broker-url: tcp://localhost:61616
user: admin
password: admin
pool:
enabled: true
#连接池最大连接数
max-connections: 5
#空闲的连接过期时间,默认为30秒
idle-timeout: 0
packages:
trust-all: true
jms:
pub-sub-domain: true
本文介绍了解决ActiveMQ在使用过程中出现的消息转换异常问题,该异常源于不可信的序列化类。通过配置信任所有包名,成功解决了问题。

被折叠的 条评论
为什么被折叠?



