At the jdb prompt, enter "suspend" to temporarily suspend all running threads in the VM. Your program will become unresponsive after you do this. Next, enter "where all" to generate the thread dump.
$ jdb -attach 9009
Set uncaught java.lang.Throwable
Set deferred uncaught java.lang.Throwable
Initializing jdb ...
All threads suspended.
> where all
JMX server connection timeout 66