Take TOMCAT7 as an example:
1. Tomcat launched as a Windows service, double-click the Tomcat installation directory under Tomcat7w.exe, and under Java-java options, add configuration parameters:
-dcom.sun.management.jmxremote
-dcom.sun.management.jmxremote.port=9000
-dcom.sun.management.jmxremote.ssl=false
-dcom.sun.management.jmxremote.authenticate=false
To start the Tomcat service, you can use the Jconsole.exe or Jvisualvm.exe in the Jdk/bin directory to add JMX Connection 9000 ports to observe the Tomcat run status information.
Note: There are no spaces after the preceding few lines, because there are spaces after 9000, and you will be prompted when you start Tomcat: "Error: Com.sun.management.jmxremote.port number is invalid: 9000"
2. Tomcat launched with the Startup.bat script can be configured directly in the Catalina.bat file
Set java_opts=%java_opts%-dcom.sun.management.jmxremote-dcom.sun.management.jmxremote.port=9000- Dcom.sun.management.jmxremote.ssl=false-dcom.sun.management.jmxremote.authenticate=false
Other, same as service startup mode.
3. When you install Tomcat as a Windows service, you can modify the parameters in the Service.bat so that the default parameters are set after the service is successfully installed without having to modify the Tomcat7w.exe again.
Modify the location at the end of the Service.bat file, such as:
REM Set extra parameters "%executable%"//us//%service_name%--jvmoptions "-dcatalina.base=%catalina_base%;-d catalina.home=%catalina_home%;-djava.endorsed.dirs=%catalina_home%\endorsed "--StartMode JVM--StopMode jvmrem More Extra Parametersset "Pr_logpath=%catalina_base%\logs" set Pr_stdoutput=autoset pr_stderror=auto "%EXECUTABLE%"//US// %service_name% ++jvmoptions "-djava.io.tmpdir=%catalina_base%\temp;-djava.util.logging.manager= Org.apache.juli.classloaderlogmanager;-djava.util.logging.config.file=%catalina_base%\conf\logging.properties; -xx:permsize=256m;-xx:maxpermsize=512m;-dcom.sun.management.jmxremote;-dcom.sun.management.jmxremote.port=9000 ;-dcom.sun.management.jmxremote.ssl=false;-dcom.sun.management.jmxremote.authenticate=false "--JvmMs--JvmMx 1024echo the service '%service_name% ' has been installed.
Windows under Tomcat add JMX monitoring