Tomcat and JMX
The MC4J Application supports connections to Tomcat 4.1, 5.0 and now also support version 5.5 servers. Tomcat has a number of managed beans in it and MC4J exposes them.
Connecting MC4J to Tomcat 5.5
Tomcat 5.5 now utilizes the built-in remote protocol of J2SE 5.0 (JDK 1.5). This means that if you run Tomcat with JDK 1.5, you can automatically expose your Tomcat server for remote management with JMX. In order to expose these features, alter your catalina.bat or catalina.sh to set the JAVA_OPTS variable with the value -Dcom.sun.management.jmxremote.port=9004. To connect MC4J to a Tomcat instance, simply select the Tomcat 5.5+ connection type when creating your server connection and alter the connect url to utilize the port set above in your catalina start file.
You'll also need to configure you 1.5 JVM for JMX remoting. This typically involves setting up the password system and disabling SSL (MC4J does not yet support SSL). For the passwords, you'll usually copy "jmxremote.password.template" in your jre's "lib/management" dir to "jmxremote.password" and setup the password you wish to use. Then edit the management.properties file in the same dir to disable the SSL requirement as described in the files comments.
Setting up Tomcat 5.0
The Tomcat developers have decided to no longer support the MX4J proprietary JMX connector on Tomcat 5.0 (http://issues.apache.org/bugzilla/show_bug.cgi?id=27894
). They now recommend running Tomcat 5.0 on a 1.5 JVM and using the built-in JMX remoting connector. Follow the directions as described above for Tomcat 5.5.
Setting up Tomcat 4.1
To connect MC4J to Tomcat 4.1 you must first enable the remote RMI management within a Tomcat server. The following steps worked for me:
Edit jk2.properties and add a line "mx.port=9000"
Edit server.xml, enable the Connector under "Coyote/JK2 AJP 1.3 Connector on port 8009"
Copy mx4j-tools.jar from your MX4J distribution and copy it to $CATALINA_HOME/common/lib directory.
Start using "catalina run" - makes it easy to look for any exceptions.
Tests
This has only been tested with Tomcat 4.1.24, 4.1.29 and Tomcat 5.0.18.
When I add -Dcom.sun.management.jmxremote.port=9004 to the JAVA_OPTS in catalina.bat tomcat doesn't start. The Tomcat window pops up and then goes away. Hmm...........