In some cases, real-time performance analysis is required for Java applications in a particular environment, and most non-development and test environments typically use JVISUALVM for basic detection to minimize the impact on the system (after it is turned on, the load affects about 20%-30%), and JVISUALVM does not provide a CLI mode , only the GUI is provided. After CentOS 6, the default is not to install graphical windows such as GNOME, in some production environments, because of network and other restrictions, the interface cannot be installed through the system disk or Yum. At this point we need to pre-start the JMX in the Java startup script, in Tomcat, as follows:
Export catalina_opts= "$JAVA _opts-dcom.sun.management.jmxremote=true-dcom.sun.management.jmxremote.port=1099- Djava.rmi.server.hostname=172.18.30.193-dcom.sun.management.jmxremote.ssl=false- Dcom.sun.management.jmxremote.authenticate=false "
172.18.30.193 is the native IP address.
Agent throws Exception: Java.rmi.server.ExportException:Port already in use:1099; Nested exception is:
Java.net.BindException:Address already in Use:jvm_bind
The above options must be set in the catalina_opts variable and set in Java_opts, and the problem will occur.
# catalina_opts (Optional) Java runtime options used when the "start",
# "Run" or "Debug" command is executed.
# Include here and isn't in java_opts all options, that's should
# only being used by Tomcat itself, not by the stop process,
# the version command etc.
# Examples is heap size, GC logging, JMX ports etc.
# java_opts (Optional) JAVA runtime options used when any command
# is executed.
# Include here and don't in catalina_opts all options, which
# should be used by Tomcat and also by the stop process,
# the version command etc.
# Most options should go to catalina_opts.
By Tomcat's stop script, it actually calls another Java runtime socket to 8005 past, so placing it in java_opts causes a jmx to be turned on, so this error occurs.
JVISUALVM Remote monitoring JVM settings