// // copy paste this code in: // // - glassfish CVS project // - jmx-remote module // - source file com.sun.enterprise.admin.jmx.remote.server.rmi.JmxServiceUrlFactory // - method localhost() // // /** * First try to get jmxConnectorHost System property. If that doesn't work, * try to resolve local hostname. If _that_ doesn't work, use localhost. * * @return * @throws RuntimeException */ static String localhost() throws RuntimeException { String jmxConnectorHost = null; jmxConnectorHost = System.getProperty("jmxConnectorHost", null); if (jmxConnectorHost == null) { try { jmxConnectorHost = java.net.InetAddress.getLocalHost().getCanonicalHostName(); } catch (java.net.UnknownHostException e) { jmxConnectorHost = "localhost"; } } return ( jmxConnectorHost ); }