I have a program that causes jstack and jcmd to fail to attach to the JVM on OS X. Unfortunately, it uses a third-party library, so I'm not sure what's the magic incantation that causes this to happen.
I wrote a small test case using this library that reproduces the problem. You can find the code here: https://github.com/martint/jstackissue. I've seen the problem on both 1.7.0_25-b15 and 1.8.0-ea-b100 on OS X, but not on Java 6. It doesn't seem to happen on Linux, either. One interesting data point is that if I run jstack before the code makes the call to the library, it works, and continues to work even after that call is complete. On the other hand, if run jstack for the first time *after* the call to the library, it won't work at all. Any ideas? Thanks! Martin