Skip to content

How to get jstack and jmap to work with Tomcat 7 installed as a service on Windows Server 2008 R2

January 18, 2013

Today I had an application server running on Tomcat 7 installed as a service, and I wanted to inspect memory and stack.

The problem is that the service, like most services, was running as ‘Local System’ and the java tools can only see processes from the same user.

The situation is further complicated thru Windows Server 2008 R2 no longer allowing any kind of interaction on part of the Local System account.

There are many pages on the internet outlining solutions, but what worked for me was this:

  1. If you’re remote desktopping, be sure to start remote desktop with the command
    mstsc /admin
  2. Install PsTools and make sure psexec is on your path
  3. Open up Task Manager, and find the PID (process id) of the tomcat (or any other java app that is running as a service)
  4. execute
    psexec -s {full path to jdk bin}jstack {PID} >> jstack.log
    psexec -s {full path to jdk bin}jjmap -dump:format=b,file=jmap.dump {PID} 
  5. Inspect jstack.log and jmap.dump



From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: