java.rmi.ConnectException:连接拒绝托管:10.0.0.57 [英] java.rmi.ConnectException: Connection refused to host: 10.0.0.57
问题描述
为什么我继续收到以下错误?我试图通过关注类似问题的帖子来解决问题,但是似乎没有任何效果.
Why I continue to receive following error? I tried to fix a problem by following posts on similar issue, however nothing seems to work.
java.rmi.ConnectException: Connection refused to host: 10.0.0.57; nested exception is:
java.net.ConnectException: Operation timed out
at .....
javax.rmi.ssl.SslRMIClientSocketFactory.createSocket(SslRMIClientSocketFactory.java:120)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:613)
... 5 more
public static void main(String[] args) throws UnknownHostException {
// Bind to registry
System.setProperty(
"javax.net.ssl.keyStore",
"/Users/xxxx/keys/printserver.jks");
System.setProperty("javax.net.ssl.keyStorePassword", "password");
System.setProperty(
"javax.net.ssl.trustStore",
"//Users/xxxx/keys/printserver.jks");
System.setProperty("javax.net.ssl.trustStorePassword", "password");
System.setProperty("javax.net.ssl.debug", "all");
//System.out.println(java.net.InetAddress.getLocalHost());
try {
System.setProperty("java.rmi.server.hostname", "191.234.6.152");
Registry r = LocateRegistry.getRegistry(null, 5099, new SslRMIClientSocketFactory());
r.bind("LoginServer", new LoginServer());
System.out.println("--- Login Server ready ---");
}
推荐答案
不,我还没有启动注册表.
No I have not started the Registry.
在那停.在启动注册表之前,您不会无所事事.您无法连接到不存在的东西.
Stop right there. You're not going to get anywhere until you start the Registry. You can't connect to something that isn't there.
奇怪的是,您得到的是连接超时而不是连接被拒绝",但是这里没有其他需要解释的东西.
It's strange that you're getting a connection timeout rather than 'connection refused', but there is nothing else here that needs explaining.
设置java.rmi.server.hostname
不能解决此问题.您在这里引用的所有问题都不是类似问题.当执行远程方法时,它们都是 client 中的连接拒绝.绑定到注册表时,这是服务器中的连接被拒绝.
Setting java.rmi.server.hostname
won't fix this problem. None of the questions you have cited here is a similar issue. They are all connection refusals in the client when executing a remote method. This is a connection refusal in the server when binding to the Registry.
这篇关于java.rmi.ConnectException:连接拒绝托管:10.0.0.57的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!