1 Reply Latest reply on Feb 7, 2008 7:28 PM by ron_sigal

    problem wiht Identity object

    mazz

      Suppose I have a box whose hostname is not resolvable via DNS (I know, I know, but for people demo'ing software on a laptop, we've seen it happen). So, I cannot "ping `hostname`" but I can "ping 127.0.0.1".

      Look at NetworkRegistry:

      public ObjectName preRegister(MBeanServer mBeanServer, ObjectName objectName) throws Exception
       {
       this.mBeanServer = mBeanServer;
       this.objectName = objectName;
       // make sure our identity system property is properly set
       Identity identity = Identity.get(this.mBeanServer);
      ...
      


      Now look at the Identity.get() method it called there:

       if(identities.containsKey(server))
       {
       return (Identity) identities.get(server);
       }
       try
       {
       String serverid = (String) server.getAttribute(new ObjectName("JMImplementation:type=MBeanServerDelegate"), "MBeanServerId");
       Identity identity = new Identity(InetAddress.getLocalHost(), createId(server), serverid);
       identities.put(server, identity);
       return identity;
       }


      It calls InetAddress.getLocalHost() but if that fails (and it will if the local hostname is not resolvable) you can *never* start a NetworkRegistry object.

      If there is an exception here in that call to InetAddress.getLocalHost(), it should fallback and use: InetAddress getByName("127.0.0.1").

      I tried setting "jboss.identity" sysprop to Identity.createUniqueID() but unfortunately, that sysprop isn't used in this class and NetworkRegistry never looks to see if that is set as a fallback.

      I understand that without a resolvable host, it hobbles things - but for demo purposes of software that will ONLY ever run on a single laptop over the loopback network adapter on 127.0.0.1, this should still work without me having to disable things like the NetworkRegistry.

        • 1. Re: problem wiht Identity object
          ron_sigal

          Hi John,

          I assigned JBREM-901 "can't start NetworkRegistry if hostname is not resolvable" to release 2.4.0.CR1. I can't think of an automated unit test for it. Could you test it when the fix is in?

          Thanks,
          Ron