Hi All,
Please review the fix for,
Issue : JDK-8031753 <http://JDK-8031753> - JMXServiceURL should not use
getLocalHost or its usage should be enhanced
Webrev :
http://cr.openjdk.java.net/~jbachorik/sponsorship/8031753/webrev.00/
The issue can be reproduced by removing entry for hostname in /etc/hosts
(for linux) and running
'javax/management/remote/mandatory/connection/RMIConnectionIdTest' test.
Hence no new jtreg test case have been written.
Fix Description:
If JMXServiceURL is given null host, it tries to resolve hostname via
InetAddress.getLocalHost() and if that fails throws
MalformedURLException. Since JMX Agent will listen on all interfaces
(0.0.0.0) if host is null, the fix handles the exception and assigns
first active non-loopback interface IP address to host. That way we can
have JMXServiceURL with IP address instead of hostname.
It is possible that we might end up constructing JMXServiceURL with IP
for an interface which clients may not be able to connect (because of
network reachability issues). In that case, the recommendation would be
to try to start JMX Agent with
com.sun.management.jmxremote.host=xx.xx.xx.xx option. That way, the
agent will be started on interface that clients can actually connect to.
Please review the fix and let me know your comments. The fix requires
amending javadoc with above behavioral change and a CCC review as well
which I will send out later.
Thanks
Harsha