Search code examples
javajconsolejvisualvmjava-service-wrapperprocrun

JVisualVM is unable to connect to process using the --openpid argument


I have an application that is running as a win-service (using Apache-Procrun). I want to monitor that application with JVisualVM. I've used the commandline argument --openpid <PID> without success, ironically the old JConsole managed to connect to that application.

JVisualVM vs JConsole 0:1

I also checked all issues with the %TMP%\hsperfdata_username -Directory that are described in the JVisualVM-Trouble Shooting Guide. Its all well.

How can i get the JVisualVM to monitor my app?


Solution

  • The JVisualVM is not able to connect to a win-service using the --openpid <PID> argument! The old JConsole can this only in WinXP because of a Bug. The alternative is to specify a JMX Agent for the service.

    This VM Arguments have to be passed to the prunsrv.exe

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

    For more detail take a look at: Connecting to JMX Agents Explicitly