4 Replies Latest reply on May 27, 2010 8:02 AM by kobiianko

    HA JNDI with no bind address

    fuzzybinary

      Hi guys!

      Is there a way to bind to all IP addresses on a machine without having the HA-JNDI system attempt to resolve a host name? When I run ./run.sh -c -b 0.0.0.0, it appears that it binds to the host name I've provided, but since I'm not running DNS on my local network, there's no way for JBoss to resolve that name into the propper IP address.

      Here's an examples of what happens when I run the distributed-queue example from jboss.messaging with both queue's started (running the example on xerxies-jboss2.

       [java] 10:31:20,774 TRACE @main [HARMIClient] Init, clusterInfo: org.jboss.ha.framework.interfaces.FamilyClusterInfoImpl@2f549848{familyName=DefaultPartition/HAJNDI,targets=[HARMIServerImpl_Stub[UnicastRef2 [liveRef: [endpoint:[xerxies-jboss.linksys:1101](remote),objID:[79cc1654:11566454501:-7ffd, -5902891377782316408]]]]],currentViewId=1706865211,isViewMembersInSyncWithViewId=false,cursor=999999999,arbitraryObject=null}, policy=org.jboss.ha.framework.interfaces.RoundRobin@df503
       [java] 10:31:20,777 TRACE @main [HARMIClient] Invoking on target=HARMIServerImpl_Stub[UnicastRef2 [liveRef: [endpoint:[xerxies-jboss.linksys:1101](remote),objID:[79cc1654:11566454501:-7ffd, -5902891377782316408]]]]
       [java] 10:31:20,782 TRACE @main [HARMIClient] Invoke failed, target=HARMIServerImpl_Stub[UnicastRef2 [liveRef: [endpoint:[xerxies-jboss.linksys:1101](remote),objID:[79cc1654:11566454501:-7ffd, -5902891377782316408]]]]
       [java] java.rmi.UnknownHostException: Unknown host: xerxies-jboss.linksys; nested exception is:
       [java] java.net.UnknownHostException: xerxies-jboss.linksys
      
      etc...
      


      Any ideas how to fix this? Is is possible to just run things without a bind address at all? (This is what I'd like, but all attempts to do it have failed).

        • 1. Re: HA JNDI with no bind address
          fuzzybinary

          To clarify, what I'm looking for (I think) is for the HA-JNDI to report a IP address to connect to instead of a host name. It looks like the host name is coming from either the bind.address or java.rmi.server.hostname variable.

          Things I've tried so far:
          - Changing the Host attribute to {jboss.bind.address}
          - Using the -Djava.rmi.server.useLocalHostname=false switch.

          • 2. Re: HA JNDI with no bind address
            fuzzybinary

            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.


            • 3. Re: HA JNDI with no bind address
              brian.stansberry

              Have you tried:

              ./run.sh -c all -b 0.0.0.0 -Djava.rmi.server.hostname=xxx.xxx.xxx.xxx ?

              Your workaround is of course more dynamic.

              • 4. Re: HA JNDI with no bind address
                kobiianko

                Hi Jeff, I'm tring to do the same thing, could you elaborate the steps needed to do it?

                 

                10x, Kobi