java监测工具之jconsole (tomcat内存监控)
Port already in use error when trying to shutdown Apache Tomcat with JMX monitoring enabled
So you tried to use JMX to monitor your Tomcat instance. You might have done so with the following lines in catalina.sh:
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8085"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
Everything started up nicely, and you were able to monitor. YAY!
But when you ran the shutdown script:
user@host:/apache-tomcat-6.0.26$ bin/shutdown.sh
Using CATALINA_BASE: /apache-tomcat-6.0.26
Using CATALINA_HOME: /apache-tomcat-6.0.26
Using CATALINA_TMPDIR: /apache-tomcat-6.0.26/temp
Using JRE_HOME: /usr/lib/jvm/java-6-sun
Using CLASSPATH: /apache-tomcat-6.0.26/bin/bootstrap.jar
Error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: 8085; nested exception is:
java.net.BindException: Address already in use
Only a kill -9 would bring down tomcat. Uh oh!
解决方法:
不能在JAVA_OPTS中配置监控端口,二者区别
# JAVA_OPTS (Optional) Java runtime options used when any command
# is executed.
# Include here and not in CATALINA_OPTS all options, that
# should be used by Tomcat and also by the stop process,
# the version command etc.
# Most options should go into CATALINA_OPTS.
# CATALINA_OPTS (Optional) Java runtime options used when the "start",
# "run" or "debug" command is executed.
# Include here and not in JAVA_OPTS all options, that should
# only be used by Tomcat itself, not by the stop process,
# the version command etc.
# Examples are heap size, GC logging, JMX ports etc.
CATALINA_OPTS="$CATALINA_OPTS -Djava.rmi.server.hostname=127.0.0.1 -Dcom.sun.management.jmxremote.port=1090 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
如果要连接远程服务器,那么参数 -Djava.rmi.server.hostname项必须设置,设置为服务器的真实ip地址。
因此可以打开jconsole,然后远程连接127.0.0.1:1090
相关推荐
- **JConsole**: JConsole是一款基于Java Management Extensions (JMX) 的图形用户界面工具,旨在帮助开发者和运维人员监控正在运行的Java虚拟机(JVM)的状态。自JDK 5.0版本开始,JConsole作为标准工具集成到了JDK中...
JConsole是Java Development Kit (JDK) 自带的一个强大的监测和管理工具,主要用于诊断和分析Java应用程序的性能问题。它基于Java Management Extensions (JMX) 技术,能提供实时的内存使用、线程状态、类加载、CPU...
【描述】:Tomcat监控工具是用于管理和监测Apache Tomcat服务器性能的重要工具。它们可以帮助管理员了解应用服务器的运行状况,包括JVM内存使用、线程状态、HTTP请求响应时间等关键指标,以便于优化性能、定位问题和...
利用VisualVM,你可以实时监控本地Java应用,如Tomcat,查看内存使用、线程状态、JVM参数、CPU消耗和垃圾回收等关键指标。这对于JVM的调优非常有帮助。特别是在Windows下,如果Java应用在NTFS格式的磁盘上运行,别忘...
### 内存溢出问题修改 #### 知识点一:理解内存溢出问题 内存溢出(Out of Memory...此外,使用适当的监控工具和技术手段对内存使用情况进行实时监测,能够帮助开发者更快地定位问题所在,并采取相应的措施进行解决。
- **内存使用情况**:监控Java应用的内存占用,包括堆内存和非堆内存。 - **线程状态**:查看应用的线程数量、状态等信息。 - **JVM启动参数**:查看应用启动时指定的JVM参数。 - **CPU消耗情况**:实时监控应用...
JConsole是一款用于监控JVM的工具,它可以显示有关JVM的各种信息,包括但不限于CPU使用率、内存使用情况等。通过JConsole提供的各种视图,可以深入了解JVM的运行状态。 - **VM Telemetry Views-GC**:该视图提供了...