我遗漏了一些关于
- 在命令提示符下启动 rmiregistry(独立于运行实现 RMI 接口(interface)的服务器的任何 Java 进程)
- 让服务器调用
LocateRegistry.getRegistry()
- 让服务器调用
LocateRegistry.createRegistry(Registry.REGISTRY_PORT)
我只希望我的服务器将其导出的对象注册到注册表,如果还没有运行则创建一个。执行此操作的最佳方法是什么?
最佳答案
旧线程但是...
man rmiregistry
说:
The methods of the java.rmi.registry.LocateRegistry class are used to get a registry operating on the local host or local host and port.
否则你有:
The URL-based methods of the java.rmi.Naming class operate on a registry and can be used to look up a remote object on any host and on the local host
所以我想这就是重要的区别。另一件事是 SecurityManager 和策略。
关于java - rmi 注册表 : best way to assure there's one running?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3639661/