Configure JMX in Tomcat

Source: Internet
Author: User
Tags visualvm

I recently looked at the JDK command line tool. Using Java visualvm and jconsole tools can both monitor the running status of Java programs (including usage of CPU and memory, and running status of threads)

In the Java visualvm tool, you can directly view the running status of the locally running Java program (such as Eclipse ).

To monitor the running status of Web applications running in Tomcat, you must enable JMX support for Tomcat.

According to the online saying, add the following paragraph to the Catalina. BAT file under the bin directory of Tomcat (note that do not wrap the line. 10000 is the JMX port number set by myself and can be changed ):

Set java_opts =-DCOM. sun. management. jmxremote-DCOM. sun. management. jmxremote. port = 10000-DCOM. sun. management. jmxremote. SSL = false-DCOM. sun. management. jmxremote. authenticate = false 

However, after a day of hard work, I did not succeed (using the netstat-ano command will not show that port 10000 is occupied and cannot be connected in Java visualvm)

Later I found out that my tomcat was installed as a Windows service. If you start startup. bat in the bin directory of Tomcat separately, you can start JMX.

To enable JMX using this method, you do not need to enter the account and password. If you need to use the account and password for authentication (for example, in the production environment), refer to other articles on the Internet.

Besides Catalina. in bat, you can use another method in addition to the preceding method: Create setenv in the bin directory of Tomcat. BAT: the content of the file is still in the bold black font.

(Unlike the content added in the Catalina. BAT file, you do not need to consider the location of the Session)

 

Configure JMX in Tomcat

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.