1

How create a memory dump of a Java process run as windows service? With tools like jVisualVM, jstack or jconsole I can not see the process because the service run with a system account.

Edit: With jVisualVM i can see the process but it show only a "Not supported for this JVM."

Horcrux7
  • 23,758
  • 21
  • 98
  • 156
  • You have more than tens questions you haven't accepted. ;) – Peter Lawrey Jun 14 '11 at 10:19
  • The two answers so far hit on the key issues - either run JConsole as admin, or set up JmxRemote, or use taskmgr(which I'll have to try - I never did it this way:) ) – ericp Jun 14 '11 at 10:27
  • @Peter Lawrey You have only one question. So you can not receive more then tens not accepted questions. – Horcrux7 Jun 14 '11 at 10:47
  • I figure as you ask more questions, you should get better at them and ask questions which have acceptable answers. I answer a lot of questions, but don't claim to be good at asking them. ;) – Peter Lawrey Jun 14 '11 at 11:14
  • See [this blog post](http://blogs.oracle.com/nbprofiler/entry/monitoring_java_processes_running_as) to find out how you can monitor java process running as Windows service. – Tomas Hurka Jun 18 '11 at 12:59
  • Same question is answered here http://stackoverflow.com/a/41257237/4090550 – Anil Agrawal Dec 21 '16 at 07:27

2 Answers2

1

To use the tools, you need to run then as the same user as the service. If you don't want this security feature, you need to set up JMX for the server will allow remote access (which will also work on the same box as a different user)

If you use taskmgr to create a low level memory dump you will have trouble finding any tools which can make sense of the output. You need to use a Java tool to trigger the dump.

Peter Lawrey
  • 525,659
  • 79
  • 751
  • 1,130
0

If you are using Windows 7 / Vista, run taskmgr as administrator, find your process, right click, "Create Memory Dump". Your other tools may work correctly if they are run as Administrator too. The process needs to be elevated to take a memory dump of a process that isn't yours.

vcsjones
  • 138,677
  • 31
  • 291
  • 286