File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JMX with Tomcat

 
Pradeep Kumar
Ranch Hand
Posts: 108
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Pradeep Kumar
Ranch Hand
Posts: 108
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20393
46
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
 
Pradeep Kumar
Ranch Hand
Posts: 108
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 108
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic