首先编辑tomcat/bin/catalina.sh 加入以下配置 (在 cygwin=false 上面加入)
CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote
-Djava.rmi.server.hostname=IP
-Dcom.sun.management.jmxremote.port=port
-Dcom.sun.management.jmxremote.rmi.port=port
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false"
注解
-Djava.rmi.server.hostname 为你自己服务器的ip地址。
-Dcom.sun.management.jmxremote.port
-Dcom.sun.management.jmxremote.rmi.port 为你要开放的端口。这个端口要是一个没有被占用的端口。记得为这个端口打开防火墙,或者加入安全组的配置。
-Dcom.sun.management.jmxremote.ssl ssl 连接配置也设置为false。
因为这是测试服务器。权限认证选的false,这样就可以直接通过ip+端口 访问了,而不用输入账号,密码了。
这样就可以通过jconsole 看看虚拟机的实时的信息了。