Search code examples
amazon-ec2profilingvisualvmjvisualvm

VisualVM cannot profile; connects and other tabs work but Sampler tab gives:"Failed to create JMX connection"


I'm trying to use VisualVM to profile an app running in EC2. VisualVM connects to the remote machine and will show me the Overview, Monitor and VisualGC tabs (with data), but when I select the Sampler tab I get:

Not available. Failed to create JMX connection to target application. Use 'Add JMX Connection' action to attach to the application.

I've tried adding the JMX connection (to the EC2 public address, and the JMX port that the app was started with) to no avail.

I can see in the VisualVM Overview tab that I've set the app's jmxsettings (and by extension that VisualVM sees those settings):

-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=9010
-Dcom.sun.management.jmxremote.local.only=false
-Dcom.sun.management.jmxremote.authenticate=false

I'm using an EC2 security model that leaves all ports open from EC2 to my local machine. I'm running the exact same JVM on both machines. I've run jstatd on the EC2 machine.

Not sure what else to try.


Solution

  • Do you use SSL authentication? If don't want to use it, try to replace

    -Dcom.sun.management.jmxremote.local.only=false

    with

    -Dcom.sun.management.jmxremote.ssl=false