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.
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.