Executing jstack getting access denied

1.2k Views Asked by At

My application is running as a windows service. When I try to take thread dump using below command from Cmd running as Administrator, I am getting access denied on a machine running on Windows 2016 server

"D:\myapp\jre\bin\java.exe" -classpath tools.jar sun.tools.jstack.JStack 2544 >log1.txt

Getting

2544: Access is denied

Similar command when I run on another machine running in Windows server 2012,it successfully captures thread dump. And both of these services are running with Local system.

As I googled and found this issue could be due to the service running under Localsystem and the command prompt(which I am using to execute jstack) running under different process, I modified the service to log on as my user account and restarted the service, still getting access denied.

Also tried using PsExec using below command:

 psexec -s "D:\myapp\jre\bin\java.exe" -classpath tools.jar sun.tools.jstack.JStack 2544 >log1.txt.

I dont know why but I am getting

Error: Could not find or load main class sun.tools.jstack.JStack.

(Just to add I am running this command from the same folder where tools.jar is residing.)

I seem to have been stuck at all places..Any help will me much appreciated

0

There are 0 best solutions below