I'm trying to use JMXAdaptorLifecycleListener with Tomcat 5.5.26 in order to be able to configure the data port for firewall navigation. Here are some of the issues I ran into and hope someone can suggest an easier workaround.
1. JMXAdaptorLifecycleListener is not compiled in the core distribution. I ended up building Tomcat 5.5.26 from source using JDK 1.5 after realizing that the standard distribution apparently excludes it from the build because it is compiled with JDK 1.4. Unfortunately this isn't obvious and not documented and I found it only after looking at the build files in the source. Unless I'm missing something, it seems that either there should be a JDK 1.5 build of tomcat in the distribution or at least this caveat should be included on the documentation page http://tomcat.apache.org/tomcat-5.5-doc/monitoring.html 2. JMXAdaptorLifecycleListener registers the PlatformMBean server with the registry whereas Tomcat's MBeans are registered with another MBean server created using the apache common's modeler registry wrapper code. Hence Tomcat's MBeans don't show up in JConsole when you connect using the URL that the JMXAdaptorLifecycleListener registers. I'm not entirely sure of a clean way of doing this. A hack that seems to work is setting the PlatformMBeanServer as the MBean server to use for Tomcat programmatically. In the constructor of JMXAdaptorLifecycleListener, adding the following does the trick, but only if it is the first listener in the server.xml file: org.apache.commons.modeler.Registry.getRegistry(null, null).setMBeanServer(ManagementFactory.getPlatformMBeanServer()); Perhaps there is a simpler way, which should be documented on the monitoring page http://tomcat.apache.org/tomcat-5.5-doc/monitoring.html. 3. Finally, the jmxUrl used in the JMXAdaptorLifecycleListener doesn't allow connecting using the Remote tab (with simply the host IP and port) rather requires a non-trivial JMX url to remember. The value used in code is: jmxUrl = "service:jmx:rmi://" + host + ":" + port + "/jndi/rmi://" + host + ":" + namingPort + "/server"; Using the following value for jmxUrl does the trick, although I'm not entirely sure of the semantic difference and any implications. Note I changed last component from "/server" to "/jmxrmi" jmxUrl = "service:jmx:rmi://" + host + ":" + port + "/jndi/rmi://" + host + ":" + namingPort + "/jmxrmi"; Thanks in advance for any insight. Regards, - Vishal