每当我尝试从客户端调用我的 ejb 时,都会收到此错误:
java.rmi.MarshalException: Failed to communicate.
Problem during marshalling/unmarshalling; nested exception is:
java.io.InvalidClassException: com.afrikbrain.util.message.MessageInfo;
local class incompatible:
stream classdesc serialVersionUID = 2285009932770474121,
local class serialVersionUID = -2900394430145132451 at
org.jboss.remoting.transport.socket.SocketClientInvoker.handleException(SocketClientInvoker
.java:122)
为什么会出现这种情况?以及如何解决?
最佳答案
本地类和远程类是不同的版本。在解码过程中,接收方不支持发送方的协议(protocol)版本。确保服务器上编译的类与客户端上编译的类版本相同,这样就可以毫无问题地进行序列化/反序列化。 我建议您从零重建所有项目并重新部署它们,并重新生成 stub 。
关于java.rmi.MarshalException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1578434/