Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I tried to enable JMX remoting on a Java app running on a server by adding the JVM args -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9001 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=xxx.xxx.xxx.xxx, but I was unable to connect to the application. Not knowing if the application was messing it up somehow, I wrote a simple test app:

public class Main {
    public static void main(String[] args) {
        while (true) {
            try {
                System.out.println("Sleeping for 5 seconds...");
                Thread.sleep(5000);
            }
           catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}

However, I could not connect to this application, either. iptables shows an open port on 9001, and netstat confirms that a connection was established, but Jconsole (and a simple Groovy script) fails due to timeout.

Because my troubleshooting has failed thus far, I've been looking into alternative ways of getting Jconsole to connect. Solutions include installing a new webserver and routing JMX through that, but that is probably not feasible for me. There is a webserver on the box but it is Hiawatha and I can't change that or install another one. What have I missed?

share|improve this question

1 Answer 1

Try these steps to troubleshoot and report back:

  1. Can you use telnet xxx.xxx.xxx.xxx 9001 from where you run the jconsole. You should see:

    Connected to xxx.xxx.xxx.xxx Escape character is '^]'.

If you do see that then that means you have a TCP connection so firewalls are not the problem.

  1. Run the following command on the server and post the output:

    $ netstat -an | grep LISTEN | grep 9001 tcp6 0 0 :::9001 :::* LISTEN

Your class and your command line:

-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9001 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false Main

work ok for me, I can connect to jconsole.

  1. Can you check what version of Java the host you want to monitor is running? java -version
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.