[jboss-user] [Clustering/JBoss] - Re: HA JNDI with no bind address

fuzzybinary do-not-reply at jboss.com
Wed Oct 3 15:22:49 EDT 2007


So, upon further investigation, I have found that this is indeed not possible without code changes.  The offending code that makes it impossible:

>From system/src/main/org/jboss/Main.java:454

  | if (rmiHost == null)
  | {
  |       rmiHost = ServerConfigUtil.fixRemoteAddress(arg);
  |       Enumeration ifaces = NetworkInterface.getNetworkInterfaces();
  |       System.setProperty("java.rmi.server.hostname", rmiHost);
  | }
  | 

>From system/src/main/org/jboss/system/server/ServerConfigUtil.java

  | public static String fixRemoteAddress(String address)
  |    {
  |       try
  |       {
  |          if (address == null || ANY.equals(address))
  |             return InetAddress.getLocalHost().getHostName();
  |       }
  |       catch (UnknownHostException ignored)
  |       {
  |       }
  |       return address;
  |    }
  | 

Which makes it impossible to bind to all addresses *and* have an IP resolve for RMI.

I have a local fix, which checks to see if the name supplied can be resolved to anything other than localhost and, if not, grabs the first (non-loopback) IP address it can find through enumerating the network interfaces.  This would not work on a multi-homed machine, but a -b with the actual IP address would probably be fine there.


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4091212#4091212

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4091212



More information about the jboss-user mailing list