1
2
3
|
# vi /etc/java-7-openjdk/management/jmxremote.password
monitorRole QED
controlRole R&D
|
1
2
3
4
5
6
|
# cd /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.31-1.b13.el6_6.x86_64/jre/lib/management/
# cp jmxremote.password.template jmxremote.password
# chmod 644 jmxremote.password
# vi jmxremote.password
monitorRole QED
controlRole R&D
|
1
2
3
4
5
6
7
8
9
|
# jstatd -J-Djava.rmi.server.hostname=192.168.1.156 &
# 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)
at sun.tools.jstatd.Jstatd.main(Jstatd.java:139)
|
1
2
3
4
5
6
|
# cd /tmp
# vi jstatd.all.policy
grant codebase
"file:${java.home}/../lib/tools.jar"
{
permission java.security.AllPermission;
};
# jstatd -J-Djava.security.policy=jstatd.all.policy -J-Djava.rmi.server.hostname=192.168.1.156 &
|
1
2
3
4
5
6
7
8
9
10
|
# cd /root/apache-tomcat-8.0.17/bin
# vi catalina.sh #找到JAVA_OPTS,在下面添加,添加的位置并没要要求
#JAVA_OPTS="$JAVA_OPTS -Dorg.apache.catalina.security.SecurityListener.UMASK=`umask`"
JAVA_OPTS="$JAVA_OPTS-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=9999
-Dcom.sun.management.jmxremote.authenticate=
false
-Dcom.sun.management.jmxremote.ssl=
false
-Djava.rmi.server.
hostname
=192.168.1.156"
# ./startup.sh
# netstat -antp |grep 9999 #查看端口是否监听
|