JBoss Console

A remote machine with 3 IP addresses (1 internal, 2 external) hosts an instance of JBoss. The default binding is on LOCALHOST; on the first available IP address, which happens to be a non-routable IP class.

Non-routable address provides security. They are ideal for internal network use and will not route through the Internet. These are:

10.0.0.0 - 10.255.255.255
172.16.0.0 - 172.31.255.255
192.168.0.0 - 192.168.255.255

Internet based clients won’t be able to connect to the JBoss server. JBoss server can be started with additional parameters to selectively bind on a different IP address.

run.bat -c default -Djava.rmi.server.hostname=nnn.nnn.nnn.nnn
.                  -Djava.rmi.server.useLocalHostname=false
.                  -Djboss.bind.address=nnn.nnn.nnn.nnn

When you do this, you may or may not require change on your EJB classes that make direct reference to LOCALHOST or 127.0.0.1. A good friend and I came out with simple workaround suggestion.

String DFTLCLHST = "127.0.0.1";

String bind = props.getProperty("jboss.bind.address");
if ((bind == null) || (bind.trim().length() == 0))
.  return DFTLCLHST;

return bind;

It’s a no brainer.

By the way, LOCALHOST and 127.0.0.1 is usually the same thing, but not always. One is a name which can be resolved to an address; the latter is a direct reference.