RMI: Conection time out: outside LAN
859078May 2 2011 — edited May 5 2011Hello i having a problem with RMI outside LAN inside the connections is fine but outside iim getting a time out exception.
java.net.ConnectException: Connection timed out: connect
java.rmi.ConnectException: Connection refused to host: 192.168.1.2; nested exception is:
java.net.ConnectException: Connection timed out: connect
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:601)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:198)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.jav
The firewall and router configuration is correct i can make make a telnet 80.25.249.95 1098 ok with out problems!!!
I look for the reason at google, and i probe all the configuration and the same problem.
I see that i have to sabliech the java.rmi.server.hostname property at the system i did it and the same.
Any idea for this issue ¿?
here my code
Server:
+ public static void register(int rmiPort)
throws RemoteException {
System.setProperty("java.rmi.server.hostname", "80.25.249.95");
Registry r = java.rmi.registry.LocateRegistry.createRegistry(rmiPort);
/* make a database instance on a random port and register
our service name and our port number on the RMI registry.*/
r.rebind("pfc", new DataFactory());
}+
Client:
+ public static IDataRemote getRemote(String hostname, String port)
throws RemoteException {
String url = "//" + hostname + ":" + port + "/pfc";
try {
System.setProperty("java.rmi.server.hostname", hostname);
//Registry registry = LocateRegistry.getRegistry(hostname);
//IDataFactory factory = (IDataFactory) registry.lookup("pfc");
IDataFactory factory = (IDataFactory) Naming.lookup(url);
return (IDataRemote) factory.getClient();
} catch (NotBoundException e) {
System.err.println("pfc not registered: "
+ e.getMessage());
e.printStackTrace();
throw new RemoteException("pfc not registered: ", e);
}/* catch (java.net.MalformedURLException e) {
System.err.println(hostname + " not valid: " + e.getMessage());
e.printStackTrace();
throw new RemoteException("cannot connect to " + hostname, e);
}*/
catch (Exception e) {
System.err.println( " error: " + e.getMessage());
e.printStackTrace();
throw new RemoteException("cannot connect to " + hostname, e);
}
}
+
i forget any configuration for well connection outside ¿?
Thnaks in advance.
Regards, Rodrigo