This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes How to use JConsole on custom remote application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to use JConsole on custom remote application" Watch "How to use JConsole on custom remote application" New topic
Author

How to use JConsole on custom remote application

Michael Golightly
Greenhorn

Joined: Feb 01, 2011
Posts: 27
We have a java application that resides on a remote server. It reads data from ActiveMQ, does stuff in Oracle, and sends some emails. I'd like to connect JConsole to it to get more insight into the inner workings of it while it is running. Since this is an in-house application not using anything like glassfish or jboss, is this possible without writing additional code into the application? If it isn't possible, can someone point me in the right direction for what I would need to write into the application in order to make it so that I can connect JConsole to it remotely?
Michael Golightly
Greenhorn

Joined: Feb 01, 2011
Posts: 27
So I've made some progress on figuring this out. (I found these pages: http://docs.oracle.com/javase/6/docs/technotes/guides/management/jconsole.html, http://docs.oracle.com/javase/6/docs/technotes/guides/management/agent.html#gcykd)

I wrote a quick application to test with:


I exported it as an executable jar (javaSandbox.jar), put it over to a remote server and ran it using this command:


That program runs without issue.

I bring up jconsole on my local box, and put in the hostname that the process is on and the port 5555. It fails to connect.

If I telnet to that host and port, it responds how I would expect:


I don't know why jconsole fails to connect. Anyone have any ideas?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Here's the JMX system properties which I have for an application which is JMX-enabled:

-Dcom.sun.management.jmxremote \
-Dcom.sun.management.jmxremote.port=8999 \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.ssl=false \

Michael Golightly
Greenhorn

Joined: Feb 01, 2011
Posts: 27
Paul Clapham wrote:Here's the JMX system properties which I have for an application which is JMX-enabled:

-Dcom.sun.management.jmxremote \
-Dcom.sun.management.jmxremote.port=8999 \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.ssl=false \


I just tried doing the -Dcom.sun.management.jmxremote.ssl=false in addition to the arguments I listed earlier and it works now! From what I read in the documentation (and the fact that I don't have it), the -Dcom.sun.management.jmxremote argument is no longer needed as of Java 6.

Thanks for your help!
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Michael Golightly wrote:From what I read in the documentation (and the fact that I don't have it), the -Dcom.sun.management.jmxremote argument is no longer needed as of Java 6.


Thanks for that info, my application predates our conversion to Java 6. So one of these days I should get rid of that property, I hate having fossils in my code.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to use JConsole on custom remote application
 
Similar Threads
Exceptions while running jconsole in Fedroa linux
Remote Monitor Classes Loaded
Connect JConsole to Websphere
jconsole to monitor server's VM args from windows client
Using the JConsole username & password