Add the following parameters to setenv.bat script of your
Tomcat (see RUNNING.txt for details).Note: This syntax is for Microsoft Windows. The command has
to be on the same line. It is wrapped to be more readable. If Tomcat is
running as a Windows service, use its configuration dialog to set
java options for the service.
For un*xes remove "set " from beginning of the line.

Tip: The password file should be read-only and only accessible by the
operating system user Tomcat is running as.

Note: The JSR 160 JMX-Adaptor opens a second data channel
on a random port. That is a problem when you have a local firewall installed.
To fix it, configure a JmxRemoteLifecycleListener, as described
in listeners documentation.

Now you can find the manager at ${manager.servletExamples.0.name} property
and can access all properties from this manager with ${manager.servletExamples.0.[manager attribute names]}.
The result object counter from MBeans is stored ad ${manager.length} property.

Example to get all MBeans from a server and store inside an external XML property file

Warning: Many Tomcat MBeans can't be linked to their parent once
created. The Valve, Cluster and Realm MBeans are not automatically
connected with their parent. Use the MBeanFacrory create
operation instead.

Tomcat offers an alternative to using remote (or even local) JMX
connections while still giving you access to everything JMX has to offer:
Tomcat's
JMXProxyServlet.

The JMXProxyServlet allows a client to issue JMX queries via an HTTP
interface. This technique offers the following advantages over using
JMX directly from a client program:

You don't have to launch a full JVM and make a remote JMX connection
just to ask for one small piece of data from a runing server

You don't have to know how to work with JMX connections

You don't need any of the complex configuration covered in the rest
of this page

Your client program does not have to be written in Java

A perfect example of JMX overkill can be seen in the case of popular
server-monitoring software such as Nagios or Ichinga: if you want to
monitor 10 items via JMX, you will have to launch 10 JVMs, make 10 JMX
connections, and then shut them all down every few minutes. With the
JMXProxyServlet, you can make 10 HTTP connections and be done with it.

You can find out more information about the JMXProxyServlet in the
documentation for the
Tomcat
manager.