9

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.

2
  • What is the downvote for? I am curious about the question!!!
    – appbootup
    Aug 8, 2013 at 3:46
  • 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!
    – rs_atl
    Aug 13, 2013 at 14:49

3 Answers 3

14

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/

1
  • The -Xverify:none was key in my case.
    – metasim
    May 29, 2014 at 16:27
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.

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.

2
  • Yes, but this advice only applies to early versions of JDK 1.6, not 1.7.
    – rs_atl
    Aug 13, 2013 at 14:47
  • 1
    Okay. If you could confirm that it doesn't have any effect in your case then it would help narrow this down.
    – Joe
    Aug 14, 2013 at 11:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.