Note: This configuration is needed if you are
going to monitor Tomcat remotely. If you are going
to monitor it locally, using the same user that Tomcat runs with, then
with Java 6 it is not needed at all, and with Java 5 it is as simple as
adding -Dcom.sun.management.jmxremote, see Java documentation.

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.