1

I am trying to profile a Java application running on my LAN from JVisualVM.

However, when I start my program with arguments like:

-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.port=9000
-Dcom.sun.management.jmxremote.ssl=false

I am unable to connect through JVisualVM, with JMX or jstatd.

9000 is forwarded, of course, and the server uses Ubuntu.

  • What is the error? Is there a firewall between VisualVM and the Java application? – hzpz Aug 11 '15 at 17:55
  • The port 9000 has been forwarded on the server, and there is no firewall between my machine and the server. The only error is that JVisualVM just can't connect. – A.J. Ruckman Aug 11 '15 at 18:30

1 Answers1

0

By default, JMX will open another random port besides the one specified with -Dcom.sun.management.jmxremote.port. Since Java 7u25, you can set this port to a fixed value:

-Dcom.sun.management.jmxremote.rmi.port=1234

You may set it to the same port as -Dcom.sun.management.jmxremote.port. See this answer for details.

If you are still having problems with the connection, try debugging it with JConsole. See the answers to this question for details.

Community
  • 1
  • 1
hzpz
  • 7,536
  • 1
  • 38
  • 44
  • It's still not connecting. Do I need to have jstatd running on the host as well? I'm not entirely sure my jstatd script is working, since I can't connect with jstatd or JMX on JVisualVM. – A.J. Ruckman Aug 11 '15 at 19:27
  • No, you don't need jstatd if you are using JMX. Try debugging the JMX connection with JConsole: http://stackoverflow.com/a/7444718/3790806 – hzpz Aug 11 '15 at 19:55
  • 2
    The problem was the lack of `-Djava.rmi.server.hostname=[LAN IP]`, thank you! – A.J. Ruckman Aug 11 '15 at 20:08