09 September 2012

jvisualvm remote monitoring


In order to monitor your remote app with jvisualvm which comes with the jdk
(location /usr/java/jdk1.6.0_30/bin)

first you should run ./jstatd in the remote server and give port like the one below;

./jstatd -p 1111 -J-Djava.security.policy=visualvm.policy

visualvm.policy is a file contains the following lines

grant codebase "file:${java.home}/../lib/tools.jar" {
     permission java.security.AllPermission;
};


security.policy is needed not to hit the following error


Could 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:374)
        at java.security.AccessController.checkPermission(AccessController.java:546)
        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)



http://download.java.net/jdk8/docs/technotes/tools/share/jstatd.html
http://docs.oracle.com/javase/1.5.0/docs/tooldocs/share/jstat.html#examples
http://java.sun.com/performance/jvmstat/

No comments: