dev@glassfish.java.net

possible patch for JmxConnectorServerDriver.java

From: Wolfram Rittmeyer <w.rittmeyer_at_jsptutorial.org>
Date: Sat, 19 Apr 2008 23:43:34 +0200

To fix issues like the one described here in the following thread
(http://forums.java.net/jive/thread.jspa?messageID=269859) I have added
some code to JmxConnectorServerDriver so that the code does not use
"localhost" for JMX (see the attached patch) if a bind address other
than "0.0.0.0" is used.

Prior to changing the code I have done a fresh maven checkout etc. And
the branch used is SJSAS91_FCS_BRANCH. If there is a V2 UR2 planned this
patch should probably merged into this branch as well.

BTW: I have signed the SCA.


Regards,

Wolfram Rittmeyer



# This patch file was generated by NetBeans IDE
# This patch can be applied using context Tools: Apply Diff Patch action on respective folder.
# It uses platform neutral UTF-8 encoding.
# Above lines and this line are ignored by the patching process.
Index: glassfish/jmx-remote/rjmx-impl/src/java/com/sun/enterprise/admin/jmx/remote/server/rmi/JmxConnectorServerDriver.java
--- glassfish/jmx-remote/rjmx-impl/src/java/com/sun/enterprise/admin/jmx/remote/server/rmi/JmxConnectorServerDriver.java Base (1.9)
+++ glassfish/jmx-remote/rjmx-impl/src/java/com/sun/enterprise/admin/jmx/remote/server/rmi/JmxConnectorServerDriver.java Locally Modified (Based On 1.9)
@@ -266,12 +266,20 @@
         //Note that the Connector Server can only be
         //started on the host where this method is called
         if (protocol == RemoteJmxProtocol.RMIJRMP) {
+ if ("0.0.0.0".equals(bindAddress)) {
             this.url = JmxServiceUrlFactory.forRmiWithJndiInAppserver(
                 JmxServiceUrlFactory.localhost(), this.port);
             this.jconsoleurl = JmxServiceUrlFactory.forJconsoleOverRmiWithJndiInAppserver(
                 JmxServiceUrlFactory.localhost(), this.port);
         }
+ else {
+ this.url = JmxServiceUrlFactory.forRmiWithJndiInAppserver(
+ bindAddress, this.port);
+ this.jconsoleurl = JmxServiceUrlFactory.forJconsoleOverRmiWithJndiInAppserver(
+ bindAddress, this.port);
     }
+ }
+ }
     private void prepare() {
         if (protocol == RemoteJmxProtocol.RMIJRMP) {
             RMIServerSocketFactory rmiregssf = new RMIServerSocketFactory() {