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)