Yasir
Yasir

Reputation: 81

Unable to start jstatd.exe to monitor applications remotely?

Great day to you all.

I want to use jstatd to monitor JVM, GC, Heap and some important metrics of some applications running in remote machines.

When I tried executing the command jstatd.exe from bin folder of the java path via commandline, I am getting the below error:

C:\Program Files (x86)\Java\jdk1.6.0_38\bin>jstatd.exe
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(AccessControlConte
    xt.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).

When we checked for this error in internet, we came to know that, we have to add some security file which is mentioned in the link cannot start jstatd due to permission error. But, still we are getting same error.

Could anyone able to help us on this.

Thanks in advance.

Upvotes: 1

Views: 2902

Answers (1)

mnhmilu
mnhmilu

Reputation: 2468

Check your Java Version by "java -version" using cmd In my case my java version was 1.7 ,so it did n't work .If this is the issue , update your policy file with right version as below:

grant codebase "file:C:/Program Files/Java/jdk1.7.0_51/lib/tools.jar" {
   permission java.security.AllPermission;
};

Now run jstatd like this one below

C:\Program Files\Java\jdk1.7.0_51\bin>jstatd -p 1234 J-Djava.security.policy=D:
\jstatd.all.policy

Hope it will work!

N.B try to connect from visualVM your remote host with this port[1234] , otherwise it won't work.

Edit:

For jdk 1.6

policy file:

grant codebase "file:C:/Program Files/Java/jdk1.6.0_45/lib/tools.jar" {
   permission java.security.AllPermission;
};

jstatd command:

C:\Program Files\Java\jdk1.6.0_45\bin>jstatd J-Djava.security.policy=D:/jstatd.
all.policy -p 1234

Upvotes: 0

Related Questions