image.png
Introduction
Monitoring is a key aspect of system administration. Looking inside a running server, obtaining some statistics or reconfiguring some aspects of an application are all daily administration tasks.
Enabling JMX Remote
Note: This configuration is needed only if you are going to monitor Tomcat remotely. It is not needed if you are going to monitor it locally, using the same user that Tomcat runs with.
The Oracle website includes the list of options and how to configure JMX Remote on Java 8: http://docs.oracle.com/javase/6/docs/technotes/guides/management/agent.html.
The following is a quick configuration guide for Java 8:
Add the following parameters to setenv.bat
script of your Tomcat (see RUNNING.txt for details).
Note: This syntax is for Microsoft Windows. The command has to be on the same line. It is wrapped to be more readable. If Tomcat is running as a Windows service, use its configuration dialog to set java options for the service. For Linux, MacOS, etc, remove "set "
from beginning of the line.
set CATALINA_OPTS=-Dcom.sun.management.jmxremote.port=%my.jmx.port%
-Dcom.sun.management.jmxremote.rmi.port=%my.rmi.port%
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
If you don't set com.sun.management.jmxremote.rmi.port
then the JSR 160 JMX-Adaptor will select a port at random which will may it difficult to configure a firewall to allow access.
If you need to specify a host name to be used in the RMI stubs sent to the client (e.g. because the public host name that must be used to connect is not the same as the local host name) then you can set:
set CATALINA_OPTS=-Djava.rmi.server.hostname
If you need to specify a specific interface for the JMX service to bind to then you can set:
set CATALINA_OPTS=-Dcom.sun.management.jmxremote.host
我这里配置-Dcom.sun.management.jmxremote.port与-Dcom.sun.management.jmxremote.rmi.port为相同的端口12345,调试成功
网友评论