This week's book giveaway is in the Spring forum.
We're giving away four copies of Spring in Action (5th edition) and have Craig Walls on-line!
See this thread for details.
Win a copy of Spring in Action (5th edition) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

RMI app behind VMWare NAT  RSS feed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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: 129.94.174.21 (host IP), virtual IP address: 192.168.170.1
- On Linux, virtual IP address: 192.168.170.128 (guest IP).
- On Virtual networking configuration, virtual NAT sets to forward port 1099 to virtual IP 192.168.170.128.
- On Linux, the RMI server is created as follow:

if (System.getSecurityManager() == null) {
System.setSecurityManager(new RMISecurityManager());
}
try {
String host = 129.94.174.21;
int port = 1099;
java.rmi.registry.Registry reg =
java.rmi.registry.LocateRegistry.createRegistry(port);
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=129.94.174.21.
- RMI client is on another physical machine and is looking up and invoking on host IP 129.94.174.21. 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.
Regards,
Van

=======================================

-bash-3.1$ ./runclient-desk.sh
reg 0 HelloServer
HelloServer found: true
HelloApplet exception: Connection refused to host: 192.168.170.128; nested
exception is:
java.net.ConnectException: Connection timed out
java.rmi.ConnectException: Connection refused to host: 192.168.170.128; nested
exception is:
java.net.ConnectException: 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(HelloApp.java:85)
at examples.hello.HelloApp.<init>(HelloApp.java:67)
at examples.hello.HelloApp.main(HelloApp.java:113)
Caused by: java.net.ConnectException: Connection timed out
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.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)
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!