You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2014/01/31 21:59:36 UTC

[Bug 56096] New: Setting rmiBindAddress on JmxRemoteLifecycleListener prevents tomcat from starting

https://issues.apache.org/bugzilla/show_bug.cgi?id=56096

            Bug ID: 56096
           Summary: Setting rmiBindAddress on JmxRemoteLifecycleListener
                    prevents tomcat from starting
           Product: Tomcat 7
           Version: 7.0.50
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: jim-apache@spudsoft.co.uk

Adding this Listener to the Server:
  <Listener className="org.apache.catalina.mbeans.JmxRemoteLifecycleListener"
          rmiRegistryPortPlatform="10001" rmiServerPortPlatform="10002"
rmiBindAddress="${ip.address}" />
Along with this setenv.sh:
CATALINA_OPTS="${CATALINA_OPTS}
-Dcom.sun.management.jmxremote.password.file=$CATALINA_HOME/conf/jmxremote.password"
CATALINA_OPTS="${CATALINA_OPTS}
-Dcom.sun.management.jmxremote.access.file=$CATALINA_HOME/conf/jmxremote.access"
CATALINA_OPTS="${CATALINA_OPTS} -Dcom.sun.management.jmxremote.ssl=false"

Prevents tomcat from starting as the two RMI components cannot talk to each
other, producing this error:
java.io.IOException: Cannot bind to URL [rmi://localhost:10001/jmxrmi]:
javax.naming.ServiceUnavailableException [Root exception is
java.rmi.ConnectException: Connection refused to host: localhost; nested
exception is:



This is caused by the preparation of the URL in createServer, which doesn't
take into account that rmiBindAddress has been used and useLocalPorts has not.
I believe that if useLocalPorts was used tomcat would start, but this would
force different instances to use different ports, which is what I'm trying to
avoid.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 56096] Setting rmiBindAddress on JmxRemoteLifecycleListener prevents tomcat from starting

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56096

Ravi Sanwal <rs...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rsanwal@gmail.com

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 56096] Setting rmiBindAddress on JmxRemoteLifecycleListener prevents tomcat from starting

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56096

--- Comment #1 from Jim Talbut <ji...@spudsoft.co.uk> ---
Diff of a fix that works for me:
Index: java/org/apache/catalina/mbeans/JmxRemoteLifecycleListener.java
===================================================================
--- java/org/apache/catalina/mbeans/JmxRemoteLifecycleListener.java    
(revision 1563195)
+++ java/org/apache/catalina/mbeans/JmxRemoteLifecycleListener.java    
(working copy)
@@ -255,7 +255,7 @@


             // Create the Platform server
-            csPlatform = createServer("Platform", rmiRegistryPortPlatform,
+            csPlatform = createServer("Platform", rmiBindAddress,
rmiRegistryPortPlatform,
                     rmiServerPortPlatform, env, csf, ssf,
                     ManagementFactory.getPlatformMBeanServer());

@@ -264,7 +264,7 @@
         }
     }

-    private JMXConnectorServer createServer(String serverName,
+    private JMXConnectorServer createServer(String serverName, String
bindAddress,
             int theRmiRegistryPort, int theRmiServerPort,
             HashMap<String,Object> theEnv, RMIClientSocketFactory csf,
             RMIServerSocketFactory ssf, MBeanServer theMBeanServer) {
@@ -278,12 +278,20 @@
                     serverName, Integer.toString(theRmiRegistryPort)), e);
             return null;
         }
+
+        if (bindAddress == null) {
+            bindAddress = "localhost";
+        }

         // Build the connection string with fixed ports
         StringBuilder url = new StringBuilder();
-        url.append("service:jmx:rmi://localhost:");
+        url.append("service:jmx:rmi://");
+        url.append(bindAddress);
+        url.append(":");
         url.append(theRmiServerPort);
-        url.append("/jndi/rmi://localhost:");
+        url.append("/jndi/rmi://");
+        url.append(bindAddress);
+        url.append(":");
         url.append(theRmiRegistryPort);
         url.append("/jmxrmi");
         JMXServiceURL serviceUrl;

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 56096] Setting rmiBindAddress on JmxRemoteLifecycleListener prevents tomcat from starting

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56096

Violeta Georgieva <vi...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #2 from Violeta Georgieva <vi...@apache.org> ---
Thanks for the report.
Fixed in trunk and 7.0.x and will be included in 8.0.2 and 7.0.51 onwards.

Regards
Violeta

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org