Tomcat開啓JMX服務很簡單,只要在catalina.sh裏添加:
CATALINA_OPTS="-Dcom.sun.management.jmxremote.port=8999 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=true
"
端口號8999可以修改爲未佔用的端口即可。
修改JAVA_HOME/jre/lib/management目錄下面的
jmxremote.access 和 jmxremote.password文件權限及內容
sudo chmod 600 jmxremote.access
monitorRole readonly
controlRole readwrite \
create javax.management.monitor.*,javax.management.timer.* \
unregister
sudo chmod 600 jmxremote.password
monitorRole QED
controlRole R&D
修改hosts文件:
把127.0.0.1修改爲真實IP
重新啓動Tomcat。