Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 323
IttayD Avatar asked Feb 20 '13 12:02

IttayD


People also ask

What is Profiler in VisualVM?

The Profiler tab of an application enables you to start and stop the profiling session of a local application. Profiling results are displayed in the Profiler tab. You can use the toolbar to refresh the profiling results, invoke garbage collection and save the profiling data.

How use VisualVM performance testing?

Under the Local node in the Applications window, right-click the application node and choose Open to open the application tab. Click the Profiler tab in the application tab. Click Memory or CPU in the Profiler tab. When you choose a profiling task, VisualVM displays the profiling data in the Profiler tab.

What is the difference between JConsole and VisualVM?

VisualVM takes application monitoring one level deeper than JConsole by allowing the user to analyze thread execution as well as the ability to profile CPU and memory usage of JVM requests, both of which are triggered manually by the user.

How do I run VisualVM?

On a Windows system, start VisualVM by double-clicking jvisualvm.exe. You can also select VisualVM from the Start menu (if Windchill shortcuts are installed). On other systems, start VisualVM by invoking the jvisualvm script.


1 Answers

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.

like image 199
efan Avatar answered Nov 01 '22 13:11

efan