Is there a way to debug why I get "Connection failed" from JConsole?
I have JMXRemote enabled on the JVM I want to monitor (I can telnet to the jmx port manually from the computer running JConsole). I've setup a password file and made sure I don't get JMX related error messages when starting the application (tomcat). Everything seems set, yet I get "Connection failed" when trying to connect to the JVM.
If you are behind a NAT or firewall you need to do additional work. The second reply of http://forum.java.sun.com/thread.jspa?threadID=289869&messageID=1242288 had the answer.
Also see:
http://java.sun.com/j2se/1.4/docs/guide/rmi/faq.html#nethostname
http://forum.java.sun.com/thread.jspa?forumID=4&threadID=565139
In short it has to do with the system property java.rmi.server.hostname and setting to a name that resolve correctly inside and outside the firewall.
The properties
-Dcom.sun.management.jmxremote.authenticate=false and
-Dcom.sun.management.jmxremote.ssl=false go together. For a while I just set the first property to false and jconcole just won't connect to the remote server. After I set both it works. Its in the docs but easy to miss.
Is there a way to enable debugging or at least display stack traces from jconsole -- I am still having trouble connecting to a JMX enabled server (OC4J) from jconsole whereas a direct JMX client connects in OK.
I've tried the authentication flags shown below to no avail.
I'd like to at least see what jconsole is doing and what error it is seeing.
where <logging.properties> is your logging.properties files.
A few times ago I have blogged about how to switch on the JMX traces and
gave a description of the JMX loggers and logging properties:
http://blogs.sun.com/roller/page/jmxetc?entry=tracing_jmx_what_s_going
You can use the logging.properties file I have shown there:
http://blogs.sun.com/roller/resources/jmxetc/logging.properties
If you're trying to debug connection problems I'd recommend you switch the
javax.management.remote logger to FINEST - and not to FINER as shown in
the file.
If it's a security related problem (using SSL) you may also want to use
-J-Djava.security.debug=all
or if you want to reduce the amount of security traces you can get a list
of debug options by typing:
java -Djava.security.debug=help foo
See
http://java.sun.com/developer/onlineTraining/Security/Fundamentals/Security.html
for more info on java.security.debug.
And if you're new to JMX/JConsole you may find this article interesting:
http://blogs.sun.com/roller/page/jmxetc?entry=where_can_i_get_my
Hope this helps,
-- daniel
JMX, SNMP, Java, etc...
http://blogs.sun.com/roller/page/jmxetc
Message was edited by:
dfuchs
I have now written a blog entry about this subject:
http://blogs.sun.com/roller/page/jmxetc?entry=troubleshooting_connection_problems_in_jconsole
able to perform the local monitoring for jconsole with pid and portnumber....But while trying with remote monitoring from different physical system its giving an error either connection failed or unkown hosts....unable to resolve the problem....please help me