]
Ron Sigal updated JBREM-901:
----------------------------
Assignee: Ron Sigal
can't start NetworkRegistry if hostname is not resolvable
---------------------------------------------------------
Key: JBREM-901
URL:
http://jira.jboss.com/jira/browse/JBREM-901
Project: JBoss Remoting
Issue Type: Bug
Security Level: Public(Everyone can see)
Affects Versions: 2.2.1.GA
Reporter: John Mazzitelli
Assigned To: Ron Sigal
Priority: Minor
Fix For: 2.4.0.CR1 (Pinto)
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.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: