users@glassfish.java.net

Connecting to a Remote EJB Module Through a Firewall

From: Witold Szczerba <pljosh.mail_at_gmail.com>
Date: Mon, 14 Dec 2009 12:37:09 +0100

Hi there,
I have a standalone EJB3 client which connects to Glassfish v2.1.
Everything works fine as long as server has IP address visible to
client.

Now, chapter 11 of Sun GlassFish Enterprise Server Application
Development Guide (for version 2, 2.1 or 3) describes how to connect
remotely to EJB from behind a NAT or firewall.
So, an example:

Server: 192.168.1.3
Router/NAT/Firewall: 10.1.1.1
Client: 10.1.1.2

Client can see 192.168.1.3 through 10.1.1.1, so it is configured like this:

Hashtable ctxEnv = new Hashtable();
ctxEnv.put("org.omg.CORBA.ORBInitialHost", "10.1.1.1");
ctxEnv.put("org.omg.CORBA.ORBInitialPort", "3700");
Context ctx = new InitialContext(ctxEnv);

This never worked, so I was digging in Development Guide and found:
"Connecting to a Remote EJB Module Through a Firewall" topic in chapter 11.

In this chapter, they say I should add 3 extra JVM options for server:
-Dcom.sun.corba.ee.ORBVAAHost=10.1.1.1
-Dcom.sun.corba.ee.ORBVAAPort=3700
-Dcom.sun.corba.ee.ORBUserConfigurators.com.sun.corba.ee.impl.plugin.hwlb.VirtualAddressAgentImpl=x
and in Configuration/ORB/IIOP Listeners/orb-listener-1:
Network Address: 192.168.1.3
Listener Port: 3700
(server was restarted)

So, according to Glassfish manual, client should connect to
10.1.1.1:3700 and everything should work just fine... But it does not
work, everything is exactly the same as it was before applying all the
options described in that chapter.
In my example, client cannot establish communication with EJB because:

WARNING: "IOP00410201: (COMM_FAILURE) Connection failure: socketType:
IIOP_CLEAR_TEXT; hostname: 192.168.1.3; port: 3700"
org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No
[...]
Caused by: java.lang.RuntimeException:
java.net.NoRouteToHostException: No route to host
[...]
Caused by: java.net.NoRouteToHostException: No route to host


Connecting from behind NAT never worked for me, but then I found that
topic in chapter 11 and... everything is the same.
Did I miss something?
Can you tell me what is wrong?