Search code examples
javamavenvisualvmjvisualvm

maven/visualvm: how can i use visualvm to profile a running surefire process?


I can attach to the surefire process, but trying to profile it shows for sampling:

CPU sampling:
Not available. Failed to create JMX connection to target application. Use 'Add JMX Connection' action to attach to the application.

Memory sampling:
Not available. Failed to read objects in target application. Check the logfile for details (use Help | About | Logfile).

And trying to start profiling shows an empty error message box


Solution

  • As it says "failed to create JMX connection" what about enabling jmx when starting maven? Here is a question how to activate jmx and i think you can use MAVEN_OPTS or JAVA_OPTS to provide those parameters to maven.