问题描述
我有一个部署到远程树脂服务器的Web应用程序,它已打开JMX。
I have a web application deployed to a remote resin server, and it has JMX turned on.
我可以telnet到远程服务器,即
I can telnet to the remote server i.e
franz@see:/tmp$ telnet <remote-ip> 5555
Trying <remote-ip>...
Connected to <remote-ip>.
Escape character is '^]'.
��sr5javax.management.remote.message.HandshakeBeginMessage�,���6profilestLjava/lang/String;Lversionq~xppt1.0^]
telnet> q
Connection closed.
但我无法使用我的JConsole连接到它
But I cannot connect to it using my JConsole
$JAVA_HOME/bin/java -cp $JAVA_HOME/lib/jconsole.jar:$JAVA_HOME/lib/tools.jar:pm-common/lib/jmxremote_optional-1_0_1_3.jar sun.tools.jconsole.JConsole service:jmx:jmxmp://<remote-ip>:5555
我用以下java版本尝试了这个,但是我在两个实例上都遇到了连接失败。
I have tried this with the following java versions but I get a 'Connection Failed' on both instances.
## where JAVA_HOME=/opt/java/64/jdk1.5.0_22
java version "1.5.0_22"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_22-b03)
Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_22-b03, mixed mode)
## where JAVA_HOME=/opt/java/64/jdk1.6.0_17
java version "1.6.0_17"
Java(TM) SE Runtime Environment (build 1.6.0_17-b04)
Java HotSpot(TM) 64-Bit Server VM (build 14.3-b01, mixed mode)
你们有没有想过如何调试这个(即找出问题所在)?
Do you guys have any idea as to how to debug this (i.e. find out what's wrong)?
推荐答案
制作确定您正在使用以下java属性集运行您的应用程序
Make sure you are running your application with following java properties set
-Dcom.sun.management.jmxremote.port=9005
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
立即尝试连接。
如果你想调试它,可以使用以下命令运行jconsole
Try to connect now.If you want to debug this ,you can run the jconsole with following command
jconsole -J-Djava.util.logging.config.file=path_to_logging.properties_for_jconsole
以下是logging.properties文件的内容
Below is the content of logging.properties file
Logging.properties
handlers = java.util.logging.ConsoleHandler
.level = INFO
java.util.logging.ConsoleHandler.level = FINEST
java.util.logging.ConsoleHandler.formatter = \
java.util.logging.SimpleFormatter
// Use FINER or FINEST for javax.management.remote.level - FINEST is
// very verbose...
javax.management.level = FINEST
javax.management.remote.level = FINER
运行 jconsole
后,会弹出一个单独的窗口显示日志。
Once you run jconsole
a separate window will pop up displaying logs.
这篇关于调试JConsole连接失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!