We are upgrading from the JBoss 4 series to JBoss 5. While working with JBoss 5, we have run into issues using remote clients.
When we launch the app server, we are passing the "-b 0.0.0.0" flag. Connections to the server from the local machine are working fine.
When we try to connect from a remote host using an initial context with the following InitialContext settings:
env.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); env.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming.client"); String providerUrl = "jnp://"+contextHost+":"+contextPort; env.setProperty(Context.PROVIDER_URL, providerUrl);
For a remote connection, the contextHost will be the ip address of the remote JBoss instance. The context port is 1099.
When I try to connect to the remote JBoss instance, I receive an exception back:
javax.naming.NamingException: Could not dereference object [Root exception is org.jboss.remoting.CannotConnectException: Can not get connection to server. Problem establishing socket connection for InvokerLocator [socket://localhost.localdomain:3873/?]]
It appears that the server is telling the client to connect to it using localhost.localdomain, which happens to be the hostname of the remote machine (we do not use DNS or similar in our environment - shoot us). Of course, the client on the remote machine then attempts to connect to the localhost, which fails since there is no JBoss running on the client machine.
As additional evidence, I set a hostname for the remote machine, and added it's IP address and host name in both the client and server's local lookup table (/etc/hosts). When I try to connect, everything works exactly as expected.
In JBoss 4, we added the following JAVA_OPTS parameter to the run.conf to resolve this issue:
This does not appear to work with JBoss 5.
Is there a way around this, other than naming all of our machines, using DNS or similar? How can I tell the JBoss server to inform remote clients to use a specific IP address?