Take the 2-minute tour ×

I know my RMI app works correctly - it works fine when the server is on localhost and inside the LAN but when connecting to an external RMI server it fails when trying to make stub calls

So the server is bound to localhost (an internal IP - but the client is specifying an external IP ( - which then gets forwarded to the internal server. How do you resolve this problem?


share|improve this question
I don't see that ending well. You really do not want to expose an RMI server. –  Tom Hawtin - tackline Mar 15 '10 at 22:50

1 Answer 1

The "simplest" approach is for your network admin to add IP forwarding from a specific port on the firewall to your server.

Assuming this isn't an option (and it probably isn't), then RMI supports tunnelling over HTTP. The performance is poor, but it's much more firewall-friendly.


This well-worn method is popular since it requires almost no setup, and works quite well in firewalled environments which permit you to handle HTTP through a proxy, but disallow regular outbound TCP connections.

If Java RMI fails to make a normal (or SOCKS) connection to the intended server, and it notices that a HTTP proxy server is configured, it will attempt to tunnel Java RMI requests through that proxy server, one at a time.

share|improve this answer

Your Answer


