Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to use VisualVM profiler with Maven Jetty plugin

I'm attempting to profile a Java 7 application executed using mvn jetty:run with VisualVM 1.3.6. The CPU shows as unavailable, and the profile tab lists the following error:

WARNING! Class sharing is enabled for this JVM. This can cause problems when profiling the application and eventually may crash it. Please see the VisualVM Troubleshooting Guide for more information and steps to fix the problem: https://visualvm.java.net/troubleshooting.html#xshare.

I am able to profile any other application normally.

The VisualVM log shows the following error a number of times:

java.io.IOException: Unable to open socket file: target process not responding or HotSpot VM not loaded

Potentially relevant details:
- OSX 10.8.3
- Both app and VisualVM running under JDK 1.7u25

I can presume the downvotes are related to the fact that there is a documented bug related to this issue with advice to set Xshare:off, I'll include this link to the bug report, which lists it as fixed after 1.6u6. I am running 1.7u25, so this does not apply to me.

like image 247
rs_atl Avatar asked Aug 07 '13 19:08

rs_atl


People also ask

Is VisualVM included in JDK?

Various optional tools, including Java VisualVM, are provided with the Java Development Kit (JDK) for retrieving different types of data about running JVM software instances.

How do I run VisualVM?

To run it, just click on the jvisualvm.exe icon. All you need to do is click on the jvisualvm.exe and the application starts up. All Java applications running will be displayed on the right hand side navigation bar. Note that there is no need to register your application with VisualVM - it'll appear automatically.

What is profiler in VisualVM?

Java VisualVM enables you to take profiler snapshots to capture the results of a profiling session. A profiler snapshot captures the results at the moment the snapshot is taken. To take a snapshot, click the Take Snapshot of Collected Results button in the toolbar while a profiling session is in progress.

Where is VisualVM EXE located?

What is VisualVM. It is a tool automatically available after JDK is installed. The executable file could be found on your <JDK installation folder>/bin as displayed below. In order to measure the performance of your application, it is necessary for the application to be recognized by VisualVM first.


1 Answers

For Mac try passing these VM args: -Xverify:none -Xshare:off

If you're working with JConsole and other JMX Tools also include:

-Xcom.sun.management.jmxremote

Found via: http://brian.pontarelli.com/2009/10/21/fixing-java-tools-on-snow-leopard/

like image 164
sechastain Avatar answered Sep 28 '22 01:09

sechastain