gpt4 book ai didi

java.io.ObjectStreamClass 无法转换为 java.lang.String

转载 作者:行者123 更新时间:2023-12-02 08:30:27 30 4
gpt4 key购买 nike

java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassCastException: java.io.ObjectStreamClass cannot be cast to java.lang.String
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:359)
at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)
at com.nxl.smssession.SessionRMI.<init>(SessionRMI.java:33)
at com.nxl.smssession.Main.main(Main.java:33)
Caused by: java.lang.ClassCastException: java.io.ObjectStreamClass cannot be cast to java.lang.String

谁能解释一下为什么会发生这个错误

当我执行RMI绑定(bind)操作时会发生这种情况

此问题仅发生在SOLARIS系统上,在Windows和Linux中工作正常

这是生成此错误的代码

public SessionRMI(String servicename) throws AlreadyBoundException {  
SessionImpl service = new SessionImpl();
try {
logger.debug("Publishing the SMS Session endpoint " + servicename);
SessionIface stub = (SessionIface) UnicastRemoteObject.exportObject(service, 0);
Registry registry = LocateRegistry.getRegistry();
registry.rebind(servicename, stub);
logger.debug("SMS Session endpoint published successfully "+servicename);
} catch (RemoteException ex) {
logger.error(ex.toString()); ex.printStackTrace();
}
}

提前致谢

最佳答案

stub 本身无法反序列化。我会仔细检查 stub 类的生成,并确保 Solaris 机器上没有任何旧的 .class 文件。

关于java.io.ObjectStreamClass 无法转换为 java.lang.String,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3521026/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com