title: jstack: Target process not responding
body: <p>I am running Ubuntu server edition and I wanted to take a thread dump of Tomcat.</p>
  
  <p>So, I first tried to find out which PID tomcat uses:</p>
  
  <pre><code>$ jps -l
  5809 sun.tools.jps.Jps
  </code></pre>
  
  <p>But it's not there?</p>
  
  <p>So, I used <code>top</code> instead and found out the PID 5730.</p>
  
  <p>Then I called jstack to get the thread dump:</p>
  
  <pre><code>$ sudo jstack -l 5730
  5730: Unable to open socket file: target process not responding or HotSpot VM not loaded
  The -F option can be used when the target process is not responding
  </code></pre>
  
  <p>What's going on? :-(</p>
  
  <p>I already tried to export CATALINA_TMPDIR as described in <a href="https://stackoverflow.com/questions/5159564/jstack-and-jstat-stopped-working-with-upgrade-to-jdk6u23">Jstack and Jstat stopped working with upgrade to JDK6u23</a> but that didn't change anything:</p>
  
  <pre><code>$ export CATALINA_TMPDIR=/tmp
  $ sudo /etc/init.d/tomcat6 restart
   * Stopping Tomcat servlet engine tomcat6
     ...done.
   * Starting Tomcat servlet engine tomcat6
     ...done.
  $ sudo jstack -l 5934 // new PID after restart
  5934: Unable to open socket file: target process not responding or HotSpot VM not loaded
  The -F option can be used when the target process is not responding
  </code></pre>
  
  <p><strong>Update:</strong></p>
  
  <p>I also tried <code>sudo -u tomcat6 jstack -l -F 5730 &gt; threaddumpexceptions2.txt</code> but it only gives me tons of exceptions on the console.</p>