Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cannot start jstatd due to permission error

Tags:

java

jvm

I try to run jstatd jvm monitoring tool on linux machine

jboss@hostAddr:/usr/java/jdk1.6.0_18/bin> uname -a Linux hostAddr 2.6.16.60-0.34-smp #1 SMP Fri Jan 16 14:59:01 UTC 2009 x86_64 x86_64 x86_64 GNU/Linux 

with following command:

jstatd -J-Djava.security.policy=~/jstatd.all.policy 

jstatd.all.policy contents

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

Unfortunately I get following output:

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:323)         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) 

For some reason jstatd runs successfully on windows with the same command and policy file.

Linux java version:

java version "1.6.0_18" Java(TM) SE Runtime Environment (build 1.6.0_18-b07) Java HotSpot(TM) 64-Bit Server VM (build 16.0-b13, mixed mode) 

Windows java version:

java version "1.6.0_26" Java(TM) SE Runtime Environment (build 1.6.0_26-b03) Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode) 
like image 999
michael nesterenko Avatar asked Mar 30 '12 08:03

michael nesterenko


People also ask

What is Jstatd?

The jstatd command is an RMI server application that monitors for the creation and termination of instrumented Java HotSpot VMs and provides an interface to enable remote monitoring tools to attach to JVMs that are running on the local host. The jstatd server requires an RMI registry on the local host.


1 Answers

Just found following script to run jstatd. I managed to run jstatd with this script https://gist.github.com/nicerobot/1375032

#!/bin/sh policy=${HOME}/.jstatd.all.policy [ -r ${policy} ] || cat >${policy} <<'POLICY' grant codebase "file:${java.home}/../lib/tools.jar" { permission java.security.AllPermission; }; POLICY  jstatd -J-Djava.security.policy=${policy} & 
like image 164
michael nesterenko Avatar answered Sep 28 '22 02:09

michael nesterenko