If you run jstatd on a machine, you will get:
So, create a jstatd.policy file and enter:
(full documentation of policy files here
then run "jstatd -J-Djava.security.policy=jstatd.policy"
Now in jvisualvm you can add remote host, then right-click on the host, "add jstatd connection" and this will connect to the default 1099 port on remote host (it's a RMI server, so it uses the default RMI port)
use "jps" from your local machine to check that the jstatd is actually reachable.
ould not create remote object
access 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:372)
at java.security.AccessController.checkPermission(AccessController.java:559)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
at java.lang.System.setProperty(System.java:783)
at sun.tools.jstatd.Jstatd.main(Jstatd.java:139)
So, create a jstatd.policy file and enter:
grant codebase "file:D:/pierre/Java/jdk1.7.0_79/lib/tools.jar" {
permission java.security.AllPermission;
};
(full documentation of policy files here
then run "jstatd -J-Djava.security.policy=jstatd.policy"
Now in jvisualvm you can add remote host, then right-click on the host, "add jstatd connection" and this will connect to the default 1099 port on remote host (it's a RMI server, so it uses the default RMI port)
use "jps