I use this to get
the JNDI properties and bind Globals.HOST in a static class initializer using
java.net.InetAddress.getLocalHost().getHostName(). The problem is
that method returns the hostname of my box NOT the hostname that JBoss was
started with using the --host switch. Given the static method call and the fact
that the JVM is not running on the bound --host, it's not surprising that
Globals.HOST is not what I want but how then do we get the --host value?
public static Properties getJNDIProperties()
{
Properties properties = new
Properties();
if(Globals.JBOSS ==
Boolean.TRUE)
{
properties.put("java.naming.factory.initial",
"org.jnp.interfaces.NamingContextFactory");
properties.put("java.naming.provider.url", Globals.HOST +
":1099");
properties.put("java.naming.factory.url.pkgs",
"org.jboss.naming");
}