所以你在日志中发现了一个异常:
Execution of JMS message listener failed, and no ErrorHandler has been set.
com.company.eq.mo.app.exception.DefaultMessageListenerException: Failed to handle message.; nested exception is com.company.eq.mo.app.exception.DefaultMessageListenerException: This message does not contain a recognised java object; nested exception is javax.jms.MessageFormatException: MQJMS1061: Unable to deserialize object the class name to find out anymore info about the message:
消息是可反序列化的,您无法在运行时获取和打印对象:
Object object = ((ObjectMessage) message).getObject();
object.getClass();
因为它不存在于你的类路径中。
是否有任何其他方式获取类/对象名称?
最佳答案
您可以为 Java 实现自己的解析器 Object Serialization Stream Protocol ,但出于大多数实际目的,您确实需要在类路径中提供所有序列化类。
关于java - 有没有办法识别可反序列化的未知 jms 对象?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11932741/