RMI Client Code Issue
Hello,
Here is my client side RMI program:
import java.rmi.*;
publicclass MyRemoteClient{
publicstaticvoid main(String args[]){
MyRemoteClient mm =new MyRemoteClient();
mm.go();
}
publicvoid go(){
try{
MyRemote service2 = (MyRemote) Naming.lookup("rmi://xxx.xxx.xx.xx/Hello");
String s = service2.sayHello();
System.out.println(s);
}catch(Exception ex){ex.printStackTrace();}
}
}
Having started RMI Registry and Service Implementor code on the server, if I try to run the above code on the client it fire the following error:
java.rmi.ConnectException: Connection refused to host: 127.0.1.1; nested exception is:
java.net.ConnectException: Connection refused: connect
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)
at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source)
at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at MyRemoteImpl_Stub.sayHello(Unknown Source)
at MyRemoteClient.go(MyRemoteClient.java:11)
at MyRemoteClient.main(MyRemoteClient.java:6)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown Source)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown Source)
... 7 more
I am wondering as to why is it trying to connect to a local host 127.0.1.1 instead of the IP Address specified at by"xxx.xx.xx.xx" in the program?
I have the stub class and the service interface classes on my client-side.
Thanks.

