Unable to use VisualVM profiler with Maven Jetty plugin
Asked Answered
M

3

10

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.

Malvia answered 7/8, 2013 at 19:12 Comment(2)
What is the downvote for? I am curious about the question!!!Tittletattle
Downvoting without a comment, flag, or other attempt to improve the question is ridiculous. I have read the relevant documentation, tried the suggestions therein, and found them unhelpful. If the question is so terrible or the answer so obvious, please do clarify!Malvia
W
15

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/

Windswept answered 21/8, 2013 at 14:8 Comment(1)
The -Xverify:none was key in my case.Segmental
B
2

on Mac, trying to profile web app in Tomcat and running JDK 1.7, I had to add the -Xverify:none flag to avoid "the Unable to open socket file: target process not responding or HotSpot VM not loaded" error message.

Bedstraw answered 20/3, 2014 at 21:38 Comment(0)
H
1

The link you include in your question (https://visualvm.java.net/troubleshooting.html#xshare) has some advice:

There is a known problem with dynamic attach which is used for profiling, it may cause target JVM to crash when class sharing is enabled. To start an application without class sharing, provide -Xshare:off argument to the java command starting the application.

Hixson answered 8/8, 2013 at 13:46 Comment(2)
Yes, but this advice only applies to early versions of JDK 1.6, not 1.7.Malvia
Okay. If you could confirm that it doesn't have any effect in your case then it would help narrow this down.Hixson

© 2022 - 2024 — McMap. All rights reserved.