本地环境,mac;
服务器环境ubuntu;
直接运行jstatd命令,提示
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:372)
at java.security.AccessController.checkPermission(AccessController.java:559)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
at java.lang.System.setProperty(System.java:783)
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:372)
at java.security.AccessController.checkPermission(AccessController.java:559)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
at java.lang.System.setProperty(System.java:783)
at sun.tools.jstatd.Jstatd.main(Jstatd.java:139)
添加一个安全策略配置文件如下:
jstatd.all.policy
内容如下:
grant codebase "file:/usr/local/java/jdk1.7.0_75/lib/tools.jar" {
permission java.security.AllPermission;
permission java.security.AllPermission;
};
然后以如下命令启动:
sudo ./jstatd -J-Djava.security.policy=jstatd.all.policy &
此时,在本地用visualvm就可以连接上此服务器来查看一些基本信息了。