I can't get VisualVM to profile local applications on OSX (although this works just fine on my Windows machine).
I am using:
- OSX: 10.9.4
- JVM: Java HotSpot(TM) 64-Bit Server VM (24.65-b04, mixed mode)
- Java: version 1.7.0_67, vendor Oracle Corporation
I find that I have to run jvisualvm (and my target application) with "sudo" otherwise the terminal window shows the following error (with a longer error appearing in the VisualVM log file):
attach: task_for_pid(6136) failed (5)
Running with sudo isn't ideal, but I can live with it.
However even when I run with sudo, the CPU graph on the Monitor tab shows:
Not supported for this JVM
The other graphs on the Monitor tab seem to be populated correctly, but the Summary on the Sampler tab shows:
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. Cannot connect to target application. Make sure the application is running on a supported JDK 6 or JDK 7.
And the VisualVM log shows:
WARNING [com.sun.tools.visualvm.jmx.impl.JmxModelImpl]: The JMX management agent cannot be enabled in this application (pid 5666)
I have tried using "XX:+StartAttachListener" as per visualvm intellij "Failed to create JMX connection to target application" profiling not working
I have also checked that my hostname resolves to an address other than 127.0.0.1 as per http://docs.oracle.com/javase/6/docs/technotes/guides/management/faq.html#linux1
Neither of these helped :(
Does anyone know how to get VisualVM profiling working on OSX Mavericks?
If so is it possible to get it to work without using sudo?