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?