Use visualvm to monitor Java Processes

Source: Internet
Author: User

1. After downloading visualvm, open:

For more information, see. Local and remote options are available in the left-side Navigation Pane. Here we mainly discuss the monitoring of remote processes.

2. The process machine needs to start the jstatd process. The command is:

Jstatd-J-Djava.security.policy = jstatd. All. Policy

The jstatd command is a built-in JDK command. Port 1099 is bound by default. The jstatd. All. Policy file here is a self-created file with the following content:

Grant codebase "file: $ {java. Home}/../lib/tools. Jar "{

Permission java. Security. allpermission;

};

It is best to put the jstatd. All. Policy file under the bin directory of JDK. The current directory will be searched by default when the file is specified. If the specified file is incorrect, the following exception is thrown:

Could not create remote objectaccess denied (java.util.PropertyPermission java.rmi.server.ignoreSubClasses write)java.security.AccessControlException: access denied (java.util.PropertyPermission java.rmi.server.ignoreSubClasses write)        at java.security.AccessControlContext.checkPermission(AccessControlContext.java:374)        at java.security.AccessController.checkPermission(AccessController.java:549)        at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)        at java.lang.System.setProperty(System.java:725)        at sun.tools.jstatd.Jstatd.main(Jstatd.java:122)

In addition, jstatd will be bound to a local IP address (the IP address displayed by hostname-I on the Internet is not verified). You can specify the binding IP Address at startup:

Jstatd-J-Djava.rmi.server.hostname = 192.168.1.115-J-Djava.security.policy = jstatd. All. Policy-P 11099

The above command binds the hostname of the process to 192.168.1.115.-P and specifies the product as 11099.

3. in the remote node of visualevm, right-click Add Remode host and add the Server IP address to automatically display the Java Process on the machine (the above is from my local, monitor the processes of a machine. The threads tab of Tomcat does not know why the details of threads are not displayed. It only displays the number of daemon and live threads. It is still being studied)

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.