I get AttachNotSupportedException
while running jmockit tests on linux (ubuntu 64bit). Java version is 1.7.0_51. This JDK is from Oracle. Tests are run using
My answer will be a little bit unrelated, but I had same issue while 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
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 jcmd Thread.dump