Problem:
When executed the command ./jstatd under JDK's bin path with the root user, got the error like following:
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:366)
at java.security.AccessController.checkPermission(AccessController.java:560)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
at java.lang.System.setProperty(System.java:781)
at sun.tools.jstatd.Jstatd.main(Jstatd.java:139)
Cause Analysis and Solution
Please refer to reference [1]
1. create a file named 'jstatd.all.policy' with content:
grant codebase "file:/opt/user/jdk-1.7.21/lib/tools.jar" { permission java.security.AllPermission; };
2. execute the command like this:
./jstatd -J-Djava.security.policy=/opt/user/jstatd.all.policy -J-Djava.rmi.server.hostname=10.2.21.63 -J-Djava.net.preferIPv4Stack=true
Note that the command execution got stuck in my case, you may not able to key in other shell commands.
However, if you remote visualvm, you can see the server's JVM information now.
Reference:
[1] http://www.nljug.org/nieuws/blog-profiling-remote-jvm-using-visualvm/