wood burning stoves 2.0*
The moose likes Other JSE/JEE APIs and the fly likes JMX with Tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "JMX with Tomcat" Watch "JMX with Tomcat" New topic
Author

JMX with Tomcat

Pradeep Kumar
Ranch Hand

Joined: Sep 08, 2006
Posts: 108
Hello ranchers,
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.

Regards,
Pradeep


Thanks and Regards, Pradeep Kumar
SCJP 1.6, SCWCD 5.0
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41104
    
  45
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.


Ping & DNS - my free Android networking tools app
Pradeep Kumar
Ranch Hand

Joined: Sep 08, 2006
Posts: 108
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?
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

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.

My full content of the "Java Options" field:


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Pradeep Kumar
Ranch Hand

Joined: Sep 08, 2006
Posts: 108
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.

Pradeep Kumar
Ranch Hand

Joined: Sep 08, 2006
Posts: 108

Finally I was able to rectify the issue. The problem was with setting CATALINA_OPTS in proper location. ;-)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JMX with Tomcat
 
Similar Threads
Tomcat Server monitoring
JConsole - Remote connect
What is the class WSLauncher needed for?
How to monitor dynamic values in JMX !!
using jconsole