activemq升级高版本
Cannot display ObjectMessage body. Reason: Failed to build body from content. Serializable class not available to broker.
Reason: java.lang.ClassNotFoundException: Forbidden class java.util.HashMap! 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.
服务端
${ACTIVEMQ_HOME}/bin/env
-Dorg.apache.activemq.SERIALIZABLE_PACKAGES=*
客户端
@Configuration
public class Config {
@Value("${spring.activemq.broker-url}")
public String brokerUrl;
@Bean
public ActiveMQConnectionFactory activeMQConnectionFactory() {
ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(brokerUrl);
//factory.setTrustedPackages(Arrays.asList("java.util.HashMap"));
factory.setTrustAllPackages(true);
return factory;
}
}
参考:http://activemq.apache.org/objectmessage.html