java:rmiregistry设置
所以我使用了LocateRegistry.createRegistry(),但这有一个问题:即它在调用它的进程内运行,所以如果我使用多个 JVM,那么 JVM 就会崩溃启动注册表的程序将删除所有 JVM 的注册表。
所以看来我需要使用 rmiregistry (或其他什么?)来隔离执行 RMI 查找/绑定的进程与服务器 JVM。
我尝试这样做,现在当我尝试执行 Registry.rebind()
时收到此错误:
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: {my remote interface name}
at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:396)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:250)
at sun.rmi.transport.Transport$1.run(Transport.java:159)
at java.security.AccessController.doPrivileged(Native Method)
我做错了什么?我用谷歌搜索了这个例外 &它与 RMI 代码库有关,但我真的迷失了这里。如果问题出在 rmiregistry
命令中,那么有哪些命令行选项可以告诉它该怎么做?如果问题出在我的服务器 JVM 中,我需要做什么?
So I was using LocateRegistry.createRegistry()
, but this has a problem: namely, it runs within the process that calls it, so if I am using more than one JVM, then a crash to the JVM that started the registry will take down the registry for all the JVMs.
So it looks like I need to use rmiregistry (or something?) to isolate the process that does RMI lookup/binding from the server JVMs.
I tried to do this, and now I get this error when I try to do Registry.rebind()
:
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: {my remote interface name}
at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:396)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:250)
at sun.rmi.transport.Transport$1.run(Transport.java:159)
at java.security.AccessController.doPrivileged(Native Method)
What am I doing wrong? I googled this exception & it has something to do with the RMI codebase, but I'm really lost here. If the problem is in the rmiregistry
command, what are the command-line options to tell it what to do? If the problem is in my server JVM, what do I need to do?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
什么崩溃?我已经很多年没有见过 JVM 崩溃了。除非您有 JNI,否则包含 RMI 服务器的 JVM 不会比 rmiregistry 命令启动的独立 JVM 更容易崩溃。使用 LocateRegistry.createRegistry() 可以永远解决您的类路径问题。
What crash? I haven't seen a JVM crash for years. Unless you have JNI the JVM containing your RMI servers is no more likely to crash than the standalone JVM started by the rmiregistry command. And using LocateRegistry.createRegistry() solves your class path problems forever.