I have a Java program on my local machine that becomes unresponsive after sometime and appears to freeze without making further progress. I guess it blocks somewhere (it is accessing remote resources over both HTTP and JDBC so a blocking situation is likely). I am trying to connect to it to see a view of the main thread's stack so as to understand where the block occurred. Both jvisualvm and jconsole list the JVM in question (among others running in my system) but both fail to connect.
jconsole balks with "connection failed" (even when I try the insecure option).
jvisualvm appears to connect but when I hit the 'sampler' tab to see the stack it complains with the screenshot below:

The thing is I am using the same utilities (jconsole and jvisualvm) to connect to other JVMs in my system which I have invoked without using any of the JMX options mentioned in this answer and I don't have any issues. How can I get the stack of this unresponsive JVM to see where it blocks?
 
     
     
    