Trying to collect thread dump of Apache Tomcat8.5 in windows server I ended using jstack
with psexec
as follows(as using jstack directly wasn't possible, so I'm using pexec to execute jstack using syetm process):
PsExec.exe -s "C:\Program Files\Java\jdk1.7.0_40\bin\jstack.exe" -l 5340 > dumps.txt
with 5340 is the PID of the running Tomcat8 process.
The execution started without any errors and it shows this output:
PsExec.exe -s "C:\Program Files\Java\jdk1.7.0_40\bin\jstack.exe" -l 5340 > dumps.txt PsExec v2.2 - Execute processes remotely Copyright (C) 2001-2016 Mark Russinovich Sysinternals - www.sysinternals.com Starting C:\Program Files\Java\jdk1.7.0_40\bin\jstack.exe on VMNAME...
When I check th dumps.txt I find it empty, even I'm running The command line as Admin.
Thnks for your help!
As a conclusion to the discussion. You need to use the same VM version for executing a jstack command as the VM version you are going to inspect. In case of any errors, you could try a -F
param to jstack.
Also, you don't need PsExec tools on newer VMs anymore.