Java RMI connection error: Not connecting to localhost
Java RMI connection error: Not connecting to localhost
我在 运行 我的应用程序时尝试连接到我的本地主机,但由于某种原因它试图连接到我的本地主机以外的 IP 地址。
以下是我收到的错误消息。
error
我查看了我的主机文件,映射如下:
hostsfile
当您手动创建 Registry
时,您可以将 14 和 17 行更改为
Registry registry = LocateRegistry.createRegistry(1099);
registry.bind("fileService", fs);
另一方面,Naming.rebind
假设主机默认为 localhost
,但您仍然可以指定它
Naming.rebind("//localhost/fileService", fs)
认为在那种情况下 LocateRegistry.createRegistry
行是不必要的
我在 运行 我的应用程序时尝试连接到我的本地主机,但由于某种原因它试图连接到我的本地主机以外的 IP 地址。
以下是我收到的错误消息。 error
我查看了我的主机文件,映射如下:
hostsfile
当您手动创建 Registry
时,您可以将 14 和 17 行更改为
Registry registry = LocateRegistry.createRegistry(1099);
registry.bind("fileService", fs);
另一方面,Naming.rebind
假设主机默认为 localhost
,但您仍然可以指定它
Naming.rebind("//localhost/fileService", fs)
认为在那种情况下 LocateRegistry.createRegistry
行是不必要的