My problem is

I have my rmi server behind the firewall+nat enivironment:
in the server i have

1: public ip: 11.12.13.14
2.local ip: 190.9.30.242
3.gateway ip:   90.9.30.240

i have assigned the public ip to java.rmi.hostname to public ip and registry.
rebind (localip, objectreference).

Server:

try
{



System.setProperty("java.rmi.server.hostname","11.12.13.14");
System.setProperty("java.rmi.server.useLocalHostnameproperty", "local ip");
}
catch (Exception ex)
{
System.out.println(ex);
}
System.setSecurityManager(new RMISecurityManager());


registry=LocateRegistry.createRegistry(3031);


registry.rebind("rmi://local ip:3031/server",this);

in the client i make an look up to remote object

Client:

String Rmi_Name="rmi://local ip:3031/server";
int port=3031;


Registry registry=LocateRegistry.getRegistry(public ip,port);


RmiInterface r=(RmiInterface) registry.lookup(Rmi_Name);


System.out.println(r.getMessage());

i get following Exception in Runtime

java.rmi.ConnectIOException: Exception creating connection to: 194.9.30.242; nested exception is:
java.net.NoRouteToHostException: No route to host: connect

Please help me...

Recommended Answers

All 4 Replies

Use of code tags would be nice

BTW where are you running the client i.e. on which machine, is it same as the one on which the rmiregistry is running or within the same local area network or from the some other comp connected to the internet ???

iam running the client through internet connection (Lan dissconnected)

You will need to open the rmiregistry port in you firewall, Also to overcome NAT you will need learn about Port forwarding.

How is you public IP connected to the Internet, is it via a Router ?
Honestly I am not yet entirely clear about your setup.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.