Saturday, September 12, 2015

monitoring remotely with jvisualvm and jstatd

If you run jstatd on a machine, you will get:

could not create remote object
access denied ("java.util.PropertyPermission" "java.rmi.server.ignoreSubClasses" "write") access denied ("java.util.PropertyPermission" "java.rmi.server.ignoreSubClasses" "write")
        at java.lang.SecurityManager.checkPermission(
        at java.lang.System.setProperty(

So, create a jstatd.policy file and enter:
grant codebase "file:D:/pierre/Java/jdk1.7.0_79/lib/tools.jar" {

(full documentation of policy files here )

then run "jstatd"

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.

See also for a more complete list of options. Particularly useful the -p option and the -J-Djava.rmi.server.hostname=x.x.x.x .

No comments: