jinfo ”can’t attach to the process”

Tried to run jinfo on my Ubuntu 12.04 and got this error message:

$ ./jinfo <vmid>
Error attaching to process: sun.jvm.hotspot.debugger.DebuggerException: Can't attach to the process

enabled debugging:

echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope

and tried again:

$ ./jinfo <vmid>
Attaching to process ID <vmid>, please wait...
Debugger attached successfully.
Server compiler detected.
...
...
$ 

Solution found here:
http://blog.thecodingmachine.com/fr/content/fixing-java-memory-leaks-ubuntu-1104-using-jmap