visualvm remote access denied

本文介绍了解决使用root用户执行./jstatd命令时出现的权限错误问题的方法。通过创建一个特定的策略文件并设置相应的环境变量,可以成功启动远程JVM监控服务。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值