20

I am trying to use visualVM for profiling a simple java application that I am debugging with Intellij. I start the application to debug, open visualVM, and I can see my application in the list. I can open it; however, I am unable to use sampling or profiling for my application. Other applications, such as Intellij, can be profiled just fine. When I check the visualVM logs I see:

INFO [com.sun.tools.visualvm.jmx.impl.JmxModelImpl]: connect(2749) com.sun.tools.attach.AttachNotSupportedException: Unable to open socket file: target process not responding or HotSpot VM not loaded

more information: Operating System = Mac OS X version 10.9.1 running on x86_64 Java; VM; Vendor = 1.7.0_51; Java HotSpot(TM) 64-Bit Server VM 24.51-b03; Oracle Corporation Intellij IDEA = 13.0.2

if anyone has this working, please let me know how you got it. I would like to use the Intellij VisualVMLauncher as well if I can get it going.

nashspence
  • 220
  • 1
  • 2
  • 7
  • 1
    I'm getting this issue as well, and none of the answers thus far have resolved it for me. – Philip Guin Apr 11 '14 at 05:06
  • Here's my logfile from VisualVM: http://www.pastey.org/view/c579846c. @nashspence, could you grab your logfile from VisualVM->About->Logfile? – Philip Guin Apr 11 '14 at 05:22

4 Answers4

22

Maybe this helps:

java -Dcom.sun.management.jmxremote \
  -Dcom.sun.management.jmxremote.port=9010 \
  -Dcom.sun.management.jmxremote.local.only=false \
  -Dcom.sun.management.jmxremote.authenticate=false \
  -Dcom.sun.management.jmxremote.ssl=false \
  -jar xxx.jar
Thomas Ahle
  • 30,774
  • 21
  • 92
  • 114
10

This looks the JDK bug #8023786. Until this is fixed in JDK 7u60, you can run the profiled application with -XX:+StartAttachListener. Some details about this bug are also in this email thread.

Tomas Hurka
  • 6,723
  • 29
  • 38
  • Hey I'll try that when I get a chance. Been traveling. Thanks for the response. – nashspence Mar 17 '14 at 11:46
  • im still having trouble getting this to work even starting my application using that flag. I find visualvm just starts to hang whenever I attempt to open the application for profiling. i intend to keep looking into the issue, but if you have any other recommendations they would be welcome – nashspence Apr 06 '14 at 00:15
  • Maybe it didn't help the OP, but it helped me. Thanks! – Karol S Oct 23 '14 at 20:44
  • This didn't work for me, but [Thomas' answer](http://stackoverflow.com/a/22957888/816458) below did. – thomas88wp Feb 06 '16 at 15:59
3

I had a similar issue earlier when running a standalone visualvm. Instead, try running the visualvm bundled with the same jdk used to run the application (in my case c:\jdk1.7.0\bin\jvisualvm.exe) and it may not need jmx in the first place.

Ali Cheaito
  • 3,746
  • 3
  • 25
  • 30
  • this ended up solving this for you? As far as I can tell, I am using the jvisualvm from the same jdk that I am running the application on. – nashspence Feb 28 '14 at 01:18
  • 1
    I also had this problem and in my case it was caused by the fact, that the app was running with a 32-bit JDK, but I used a 64-bit VisualVM. – Mareen Aug 31 '15 at 11:38
  • Solved the problem for me in two different cases. – MiaoHatola Oct 03 '17 at 10:03
0

If it may help anyone, a solution I found was to launch the application in IntelliJ via the VisualVM launcher plugin for IntelliJ . It worked for me with a web application on Glassfish.

marcor92
  • 417
  • 5
  • 13