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