和以上问题一样,说是没有序列化,但是已经序列化了,网上也找了很久,问题还是没解决,看到老师发了一个那个链接,在targetConnectionFactory中添加配置:https://yq.aliyun.com/articles/663331 我很想问,这个targetConnectionFactory在哪?似乎这个视频不是用的Spring整合的,这个targetConnectionFactory我着实没找到在哪,还请老师明示。
问题同上,报错如下:
javax.jms.JMSException: Failed to build body from content. Serializable class not available to broker. Reason: java.lang.ClassNotFoundException: Forbidden class com.bjsxt.User! 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:213)
at com.bjsxt.HelloWorldConsumer2.ReadHelloWorldFromActiveMQ(HelloWorldConsumer2.java:57)
at com.bjsxt.TestC.main(TestC.java:8)
Caused by: java.lang.ClassNotFoundException: Forbidden class com.bjsxt.User! 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.ClassLoadingAwareObjectInputStream.checkSecurity(ClassLoadingAwareObjectInputStream.java:111)
at org.apache.activemq.util.ClassLoadingAwareObjectInputStream.resolveClass(ClassLoadingAwareObjectInputStream.java:56)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1826)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1713)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2000)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1535)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:422)
at org.apache.activemq.command.ActiveMQObjectMessage.getObject(ActiveMQObjectMessage.java:211)
... 2 more
Process finished with exit code 0