Adding JMX support to your java app

what is JMX?

JMX is a technology that lets you add management interfaces for Java applications

the jmx interface on your java application will let you monitor and publish graphs for:

  • heap memory
  • threads and their stack trace
  • CPU
  • classes
  • memory pools
and it will also expose the java Mbeans tree which you can browse
with the jconsole app included with any java distribution:
you can either browse and read these attributes,
and in some cases edit them and change the application status.

Enabling JMX in Tomcat

to enable JMX in tomcat,
edit the wrapper.conf file , and add these lines:<port><ServerName>
Things to verify before usage:
  1. the numbers after the “” part are in increasing order – make sure to continue from where the last config line showed, and make sure there are no gaps in the counting.
  2. change <port> to the port number you wish to expose
  3. these settings will enable password-less connection to you JMX server, if you wish to add authentication and SSL you will need to change these settings.
  4.  change <ServerName> to your server name – this setting is needed – without it the server will only allow localhost connections and wont allow remote.

Technorati Tags: , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>