[jboss-jira] [JBoss JIRA] Created: (JBREM-901) can't start NetworkRegistry if hostname is not resolvable
John Mazzitelli (JIRA)
jira-events at lists.jboss.org
Wed Feb 6 13:13:03 EST 2008
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
Priority: Minor
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: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list