Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RMI app behind VMWare NAT

Van Ho
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I'm also having problem with RMI app behind NAT as well. Could you please
help me to identify problem and to solve it?

The scenario is as follow:

- My RMI server is running on Linux machine which is running as guest on VMWare with Windows XP is host OS.
- On XP, physical IP address: (host IP), virtual IP address:
- On Linux, virtual IP address: (guest IP).
- On Virtual networking configuration, virtual NAT sets to forward port 1099 to virtual IP
- On Linux, the RMI server is created as follow:

if (System.getSecurityManager() == null) {
System.setSecurityManager(new RMISecurityManager());
try {
String host =;
int port = 1099;
java.rmi.registry.Registry reg =
HelloImpl obj = new HelloImpl(port);
// Bind this object instance to the name "HelloServer"
Naming.rebind("//" + host + ":" + port + "/HelloServer", obj);

- And the server is running with option -Djava.rmi.server.hostname=
- RMI client is on another physical machine and is looking up and invoking on host IP And I got "Connection refused to host", as stack trace shown below.

- If I run RMI client on host machine, connection is fine. I've also verified that the host machine is accepting incoming calls by running RMI server on host machine, and RMI client from the same machine that I run RMI client earlier. The connection is OK as well.

Am I missing something here?

Thank you very much in advance.


-bash-3.1$ ./
reg 0 HelloServer
HelloServer found: true
HelloApplet exception: Connection refused to host:; nested
exception is: Connection timed out
java.rmi.ConnectException: Connection refused to host:; nested
exception is: Connection timed out
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 examples.hello.HelloImpl_Stub.sayHello(Unknown Source)
at examples.hello.HelloApp.init(
at examples.hello.HelloApp.<init>(
at examples.hello.HelloApp.main(
Caused by: Connection timed out
at Method)
at Source)
at Source)
at Source)
at Source)
at Source)
at<init>(Unknown Source)
at<init>(Unknown Source)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic