java.rmi.NotBoundException。发现可用的绑定

java.rmi.NotBoundException . Discovering what bindings are available

下面是java.rmi.registry.Registry

实现的绑定
CustomRegistry: registryCount = 2
reg1.com:11, # of bindings = 2
 OPTIONS
 UPDATES
reg2.com:11, # of bindings = 1
 TEST

当我使用

(MyRegistry)registry.lookup("OPTIONS");

我收到异常:java.rmi.NotBoundException: OPTIONS

阅读此站点上对此异常的解释后,似乎无法发现绑定 "OPTIONS"。

由于 RMI 服务器在不同的机器上,是否有一种机制可以用来发现服务器上可用的绑定 reg1.com % reg2.com

After reading explanations of this exception on this site then it appears the binding "OPTIONS" is not discoverable.

不,不是。表示没有绑定。

As the RMI servers are on a different machine

无关。

is there a mechanism I can use to discover the bindings available on servers reg1.com % reg2.com

Registry.list().Registry.list() 编辑的任何字符串 return 都可以直接插入到 Registry.lookup() 到 return 的绑定中,除非它在两者之间未绑定,这不太可能。

类似地,由 Naming.list() 编辑的任何字符串 return 都可以插入 Naming.lookup().

但是你不能把它们混在一起,例如将由 Registry.list() 编辑的字符串 return 传递给 Naming.lookup(),,因为 Naming 处理 RMI URL,而 Registry 只处理名称。