简体   繁体   English

Linux上的java.rmi.NoSuchObjectException

[英]java.rmi.NoSuchObjectException on Linux



i'm developing two via RMI connected apps. 我正在通过RMI连接的应用程序开发两个。 Communication is bidirectional and everything works just fine, until i'm running on windows. 通信是双向的,一切正常,直到我在Windows上运行。 when i take jar files to Debian, connection fails with java.rmi.NoSuchObjectException . 当我将jar文件带到Debian时, java.rmi.NoSuchObjectException连接失败。

Any idea what difference linux makes or why isn't it working ? 知道linux有什么区别吗?为什么它不起作用?

EDIT: my code: 编辑:我的代码:
Server side: 服务器端:

static Registrator clientRegistrator = null; // static field, interface extending java.rmi.Remote
...
Registry rmiRegistry = LocateRegistry.createRegistry(RmiConstants.RMI_REGISTRY_PORT);
clientRegistrator = (Registrator) UnicastRemoteObject.exportObject(new RmiClientRegistrator(networkListeners), RmiConstants.RMI_REGISTRY_PORT); // RmiClientRegistrator implements Registrator interface
rmiRegistry.bind(RmiConstants.RMI_SERVER_MARK, clientRegistrator);


Client side: 客户端:

static Registrator serverRegistrator = null;
String rmiConnectionString = "rmi://localhost:" + RmiConstants.RMI_REGISTRY_PORT + "/" + RmiConstants.RMI_SERVER_MARK;
serverRegistrator = (Registrator) Naming.lookup(rmiConnectionString);
serverRegistrator.registerClient(dataReceiver); // fails here, with mentioned exception

The remote object referred to by your stub no longer exists. 存根引用的远程对象不再存在。 More accurately, it is no longer exported. 更准确地说,它不再导出。 This shouldn't happen while a client still has a live stub to it, unless you unexported it yourself, or unless a network partition caused a DGC failure. 当客户端仍然具有实时存根时,除非您自己取消导出它,或者除非网络分区导致DGC失败,否则不应发生这种情况。

The surest remedy against this is to keep a static reference to the remote object in the JVM it was exported from. 对此的最确定的解决方法是在从其导出的JVM中保持对远程对象的静态引用。

Did you see here: 您在这里看到了吗?

java.rmi.NoSuchObjectException: no such object in table java.rmi.NoSuchObjectException:表中没有此类对象

Java RMI NoSuchObjectException Java RMI NoSuchObjectException

and here : 在这里

A NoSuchObjectException is thrown if an attempt is made to invoke a method on an object that no longer exists in the remote virtual machine. 如果尝试在远程虚拟机中不再存在的对象上调用方法,则会引发NoSuchObjectException If a NoSuchObjectException occurs attempting to invoke a method on a remote object, the call may be retransmitted and still preserve RMI's "at most once" call semantics. 如果发生NoSuchObjectException尝试在远程对象上调用方法,则该调用可以重新传输,并且仍保留RMI的“最多一次”调用语义。 A NoSuchObjectException is also thrown by the method java.rmi.server.RemoteObject.toStub and by the unexportObject methods of java.rmi.server.UnicastRemoteObject and java.rmi.activation.Activatable and java.rmi.server.RemoteObject.toStub方法以及java.rmi.server.UnicastRemoteObject和java.rmi.activation.Activatable的unexportObject方法也会引发NoSuchObjectException异常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM