[
http://jira.jboss.com/jira/browse/JBREM-901?page=comments#action_12401715 ]
Ron Sigal commented on JBREM-901:
---------------------------------
Changed org.jboss.remoting.ident.Identity.get() to
public static synchronized final Identity get(MBeanServer server)
{
if(identities.containsKey(server))
{
return (Identity) identities.get(server);
}
try
{
InetAddress localHost = null;
try
{
localHost = InetAddress.getLocalHost();
}
catch (IOException e)
{
localHost = InetAddress.getByName("127.0.0.1");
}
String serverid = (String) server.getAttribute(new
ObjectName("JMImplementation:type=MBeanServerDelegate"),
"MBeanServerId");
Identity identity = new Identity(localHost, createId(server), serverid);
identities.put(server, identity);
return identity;
}
catch(Exception ex)
{
String type = ex.getClass().getName();
final RuntimeException rex = new RuntimeException("Exception creating
identity: " + type + ": " + ex.getMessage());
rex.setStackTrace(ex.getStackTrace());
throw rex;
}
}
There are no specific unit tests, but will check for new failures in hudson.
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
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:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira