Reputation: 219
i run this code in my system and i don't weather to write localaddress(localhost) or remote addres(IP address)...
ref= (RMISIntf)Naming.lookup("rmi://"+"192.168.0.15"+"/RMIServer");
and also i try this code also till i get no response
ref= (RMISIntf)Naming.lookup("rmi://"+"localhost"+":"+8033+"/RMIServer");
//MyRemoteObject ro = (MyRemoteObject) Naming.lookup("//" + "localhost" + ":" + port + "/" + name);
//ref=Naming.rebind("rmi://localhost:8080/RmiServer",RMISIntf);
Upvotes: 2
Views: 2799
Reputation: 23356
It is good to test first with the localhost as it is easy and does not require to set rules as is with the remote connection i.e. the external address.
The Java RMI faq says,
The appropriate workaround is to set the system property java.rmi.server.hostname when starting the server. The value of the property should be the externally reachable hostname (or IP address) of the server -- whatever works when specified as the host-part in Naming.lookup is good enough.
Also just have a look at the properties for remote method invocation here.
Upvotes: 2
Reputation: 29233
You should be able to make it work using any of the two, but keep in mind that for it to work with the external address, you may need to create some rules on your firewall and forwarding on your modem.
Upvotes: 0