应用场景
在Jboss web容器开发过程中经常会遇到监测Java程序使用CPU、内存堆栈等情况,需要开启jboss的JConsole
开启设置
- 打开run.bat
- 找到set JAVA_OPTS=%JAVA_OPTS%
- 在后面添加如下内容:
-Djava.rmi.server.hostname=10.5.35.151 设置访问的主机地址
-Dcom.sun.management.jmxremote.port=8950 设置端口
-Dcom.sun.management.jmxremote.authenticate=false 不需要认证
-Dcom.sun.management.jmxremote.ssl=false 不需要SSL
如果需要设置用户名和密码,则
-Dcom.sun.management.jmxremote.authenticate=true
同时还要设置密码文件
-Dcom.sun.management.jmxremote.password.file=$JAVA_HOME/jre/lib/management/jmxremote.password
在jmxremote.password文件中增加用户名密码即可。