I have installed tomcat 6 with installer on Windows machine. I am not able to use Jconsole to connect to tomcat to see the registered MBeans. How do I connect to tomcat with Jconsole. Also how do i integrate the JMX with tomcat. Kindly reply. I am using jdk 1.6.
Thanks and Regards, Pradeep Kumar
SCJP 1.6, SCWCD 5.0
Not sure what you mean by "integrate the JMX with Tomcat", but if you want to connect from JConsole to TC then you need to start TC with the "-Dcom.sun.management.jmxremote" property. The easiest way to do that would be to add a line like CATALINA_OPTS="-Djava.awt.headless=true -Dcom.sun.management.jmxremote" at an appropriate location to the bin/catalina.bat script.
Joined: Sep 08, 2006
Ulf Dittmer wrote:The easiest way to do that would be to add a line like CATALINA_OPTS="-Djava.awt.headless=true -Dcom.sun.management.jmxremote" at an appropriate location to the bin/catalina.bat script.
I have installed tomcat using the installer where in i do not have an option to edit the catalina.bat file. In this case how do I connect JConsole with TC?
You can use the "Configure Tomcat" shortcut that is created for you. Go to the "Java" tab, you can then add a new line to the "Java Options" field. It is recommended to use one line for each option so it will be a bit clearer where one option ends and the next one starts. For instance, I only added "-Dcom.sun.management.jmxremote" there and now I can see the memory MBeans in Lambda Probe. I couldn't get JConsole to connect to it yet but that has something to do with the security settings.
I am able to configure the tomcat with JConsole. But I am not able to view the Mbeans deployed in tomcat using JConsole. How do I register in tomcat server and view the MBeans in jconsole. I tried using RMIconnector and I was able to see the deployed mbeans on tomcat using JConsole. The jsp code is given below for reference.
An in the JConsole i connected using the remote process giving the service:jmx:rmi:///jndi/rmi://<hostname>:8999/server value. Also I had started the rmi registry on 8999 port. I am not able to connect to tomcat directly. Kindly help me where I am going wrong.
Joined: Sep 08, 2006
Finally I was able to rectify the issue. The problem was with setting CATALINA_OPTS in proper location. ;-)