Monitoring Remote Java Applications with VisualVM

Hey guys, the blog updates have slowed since I found Minecraft. Fairly addictive. Just a quick one today.

To monitor a remote Java application with VisualVM, simply use jstatd

Start jstatd on the remote machine, make a connection from VisualVM to the remote machine and we can then monitor all running Java applications.

If you try starting jstatd without specifying a policy you may get the following error.

$ ./jstatd
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(

Create a security policy file if one does not already exist called ‘jstatd.all.policy’ (same location as jstatd). Add the following to the file:

grant codebase "file:${java.home}/../lib/tools.jar" {



Then simply run jstatd with:

$ ./jstatd &

You can test the connection using the following command

$ jps -l -m -v rmi://localhost

If you’re experiencing problems make sure you run jstatd with the same user as the java processes. It could be that the ports used my jstatd are blocked by your firewall. jstatd uses two ports, the once specified and a random port. Check the ports by running the following command

$ netstat -nap | grep jstatd
tcp        0      0 :::47232    :::*   LISTEN      23185/jstatd        
tcp        0      0 :::1099      :::*     LISTEN      23185/jstatd  

EDIT: You can find the log files for visualvm here






30 Jun 2011