• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

JMX with Tomcat

 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Sheriff
Posts: 22798
131
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Finally I was able to rectify the issue. The problem was with setting CATALINA_OPTS in proper location. ;-)
 
If you are using a rototiller, you are doing it wrong. Even on this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic