I am trying Remote calls using RMI registry for the first time. I have written the interface and class which implements it. Am facing the problem when am trying to invoke it. I've started rmiregistry in my windows machine by giving start rmiregistry
, which opened a new window.
Client side prg looks like:
String host = "172.27.49.199:1099";
try {
System.out.println(LocateRegistry.getRegistry());
Registry registry = LocateRegistry.getRegistry(host,0);
Details stub = (Details) registry.lookup("Hello");
String response = stub.Name();
System.out.println("response: " + response);
} catch (Exception e) {
System.err.println("Client exception: " + e.toString());
e.printStackTrace();
}
I am confused on with what value needs to be given for host
.
I've tried giving:
(a) http://localhost
(b) http://localhost:1099
It leaves java.net.UnknownHostException: http://localhost:1099
.
Update:
After changing host to My_Sys_IP, I lost java.net.UnknownHostException
but ending up with Client exception: java.rmi.NotBoundException: Details