4 Replies Latest reply: Sep 8, 2010 3:03 AM by 843798 RSS

    How to access MBeans without knowing the port (like JConsole/VisualVM do)

    843798
      I have a Java 5 application server running on Solaris 8 (not going to be upgrading Java). The JVMs for the app server are being started with -Dcom.sun.management.jmxremote (no port number specified).

      Both JConsole and VisualVM can interrogate the MBeans in the JVMs, but I cannot figure out what the URL is. It must be possible, JConsole and VisualVM do it.

      For my testing, I have been using the JVMRuntimeClient is Dan Fuchs' blog http://blogs.sun.com/jmxetc/entry/how_to_retrieve_remote_jvm
      bash-2.03$ java -classpath .:$JAVA_HOME/lib/tools.jar JVMRuntimeClient -pid 13995
      cannot attach to target vm 13995: java.io.IOException: Permission denied
      JVMRuntimeClient -url | -port [-host | -help
      Exception in thread "main" java.lang.IllegalArgumentException: cannot attach to target vm 13995: java.io.IOException: Permission denied
      I am running under the same uid as the app server, and again, JConsole and VisualVM (both running from the same Java 6 install that I am using) can get to the MBeans just fine from the same shell prompt.

      The same program seems to be ok running on my Windows development box.

      What am I missing? How do JConsole and VisualVM determine the URL of the JMX server for a JVM?