Monitor Railo on Tomcat using JConsole
At Learnosity, I’ve been trying to get to the bottom of a “Java Heap Space” error on my local Railo installation and decided to use JConsole to monitor Tomcat server. JConsole is a very useful Java application monitoring tool, which is bundled into every JRE. You can run it by simply executing jconsole binary:
$JAVA_HOME/bin/jconsole
Where $JAVA_HOME is the path to your Java installation.
By default, JConsole picks up all local Java processes, which you can monitor individually. Unfortunately, Tomcat doesn’t seem to be listed under local processes and I had to use remote connection instead. The way to connect to Tomcat with JConsole is a little tricky and this is what you need to do:
You need to tell Tomcat to accept clients on TCP port 8999, on the host “localhost”, without authentication.
DO NOT disable remote authentication in production environment. It should only be done for testing purposes in development/staging environments. closeTo translate this into code, set CATALINA_HOME environment variable to this:
$CATALINA_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8999 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=localhost"; $ export CATALINA_OPTS;
(Re)start Tomcat and you should now be able to monitor it on localhost:8999
Here are some JConsole screen shots:


References:
Monitoring Tomcat with JMX
Using JConsole to Monitor Applications

-
David Boyer 1 September 30, 2010, 1:01 pm
TopHi Marko,
Great post, jConsole can be a really useful tool. I’ve actually manage to expose almost all of the same information via a ColdFusion based application. The project is called CfTracker (http://www.cftracker.net).
I’ve just started to think of adding remote support via JMX so the tomcat configuration settings are going to be really useful to me
Cheers,
Dave
-
Marko Tomic 2 September 30, 2010, 1:11 pm
TopHi Dave,
Thanks for the link. I had heard of cftracker before, but wasn’t sure what it did. It looks like a great monitoring tool. I’ll try it out.
Cheers
Marko