Start JMX remote feature, use Jconsole to monitor Tomcat

Source: Internet
Author: User
Tags tomcat jconsole

Tested on Tomcat, theoretically tried on any Java process, and any program that implements the JMX specification.


Modify the $catalina_home/bin/catalina.sh file and add the following JVM parameters

-DCOM.SUN.MANAGEMENT.JMXREMOTE.PORT=18100//Specify JMX connection ports

-dcom.sun.management.jmxremote.authenticate=false//this configuration is insecure. Any remote user who knows (or guesses) your JMX port number and host name would be able to monitor and control your Java AP Plication and platform. While it may was acceptable for development, it was not recommended for production systems. This parameter is enabled by default

-dcom.sun.management.jmxremote.pwd.file=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/management/ Jmxremote.password

-dcom.sun.management.jmxremote.ssl=false//default is True, need to specify


-dcom.sun.management.jmxremote.pwd.file the file path specified by this parameter, the default is under $jre_home/lib/management,  The default is to have only one jmxremote.password.template file, copy this file into Jmxremote.password, modify the last 2 lines to specify the username password, such as: Monitorrole 123456 (Use this pair of username and password when connecting with Jconsole) of course, JVM parameters

-dcom.sun.management.jmxremote.authenticate=false, you can connect without a password


Enable JMX There are a number of other JVM parameters that can be configured, configured to use password connections and secure connections using SSL, and so on, not one to try, see http://docs.oracle.com/javase/6/docs/technotes/guides/ Management/agent.html.


The process also needs to modify the machine's hosts,

# vi/etc/hosts

127.0.0.1 (modified to machine IP) localhost localhost.localdomain localhost

Modify the Machine host name file (not modified, but to match with hosts):/etc/sysconfig/network



Note: After you add these JVM parameters to the catalina.sh file, you will be prompted to use the Jmxremote port when you run shutdown.sh. The reason is that running the shutdown.sh script starts a JVM and attempts to bind the Jmxremote port, causing the problem. See https://issues.apache.org/bugzilla/show_bug.cgi?id=36976. There is no way to solve it, the direct kill process (should be able to be resolved through configuration).


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.