我试图在我的服务器上启动jstatd,但我一直收到此错误:
[ec2-user@ip-204-95-69 bin]$ sudo jstatd -J-Djava.security.policy=/home/ec2-user/logstash-5.2.0/bin/jstatd.all.policy
java.security.policy: error adding Entry:
java.net.MalformedURLException: no protocol: /usr/java/jdk1.8.0_92/lib/tools.jar
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:472)
at java.security.AccessController.checkPermission(AccessController.java:884)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
at java.lang.System.setProperty(System.java:792)
at sun.tools.jstatd.Jstatd.main(Jstatd.java:139)
[ec2-user@ip-204-95-69 bin]$
我已将策略文件设置为如下所示:
grant codebase "/usr/java/jdk1.8.0_92/lib/tools.jar" { permission java.security.AllPermission; };
我需要设置什么才能让它开始?我也尝试了sudo
,但这也不起作用。
现在,如果我在-J
这样的情况下运行它...... jstatd -p 9050 -Djava.security.policy=/homejstatd.all.policy -Djava.rmi.server.hostname=ip-address
我一直回来......
[ec2-user@ip-204-95-69 bin]$ jstatd -p 9050 -Djava.security.policy=/home/ec2-user/logstash-5.2.0/bin/jstatd.all.policy -Djava.rmi.server.hostname=ip-address
usage: jstatd [-nr] [-p port] [-n rminame]