java:rmiregistry设置

发布于 2024-11-01 20:13:56 字数 937 浏览 0 评论 0原文

所以我使用了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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

心的位置 2024-11-08 20:13:56

什么崩溃?我已经很多年没有见过 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文