java.rmi.ConnectException: Connection refuse
843793Apr 21 2005 — edited Aug 30 2006Hi all,
I have built a simple RMI client server application.I can run client & server fine locally.
However if I test this appplication over the internet, I get this exception on the client:
java.rmi.ConnectException: Connection refused to host: 169.254.157.53; nested exception is:
java.net.ConnectException: Connection timed out: connectConnection refused to host:169.254.157.53
The RMI server is running on my PC and the client on a friend's remote PC.Both PCs are connected to Internet.
I don't have any firewall running on my PC (including windows XP firewall). The server RMI lookup on the client happens correctly,
the exception is raised when the client tries to call the remote method on the server.
Here is an extract of my RMI server code (it works locally):
public static void main(String[] args) throws Exception {
try {
// args[0] contains the database server name given as command line argument, arg[1] contains binary path that contains weather jpeg files
CPrimaryWeatherServer test = new CPrimaryWeatherServer(args[0], args[1]);
Naming.rebind("rmi://localhost:1099/WeatherPrimaryService", test);
System.out.println("Serveur m�t�o principal d�marr�");
} catch (Exception e){ System.out.println(e.getMessage());}
}
}
Here is an extract of my RMI client code (it works locally):
try{
rec=1;
leftClik=1;
System.out.println("Before RMI lookup");
IPrimaryWeatherServerService serveur =(IPrimaryWeatherServerService)Naming.lookup("rmi://"+primWS+":1099/WeatherPrimaryService");
System.out.println("After RMI lookup");
System.out.println("Before server method call");
z=serveur.getFullWeatherData(); --> exception is raised here
System.out.println("After RMI server method call");
I am directly connected to Internet using an ethernet card connected to an ADSL modem.169.254.157.53 is the automatic IP of my network card different from the IP given by my ISP. By the way, the client tries to contact me using my DNS name that resolves correctly to my ISP IP adress.
Thanks a lot for help,