com.sun.tools.attach.AttachNotSupportedException: Unable to open socket file: target process not responding or HotSpot VM not loaded

I had the same issue while I was trying to dump threads using jcmd. I was getting same error message even though I was running jcmd under the root user.

You need to run jcmd <pid> Thread.print under the same user as java process has, otherwise your connections will be dropped. Java doesn’t care if you are root or not.

So basically:

sudo -u <java_process_user> jcmd <pid> Thread.print

Leave a Comment