开发者

Java5 on Windows service app - get Full Thread Dump need clarification

开发者 https://www.devze.com 2023-01-14 18:37 出处:网络
I\'ve looked through couple of articles here such as: java stack dump on windows Thread dump programmatically /JDI (Java Debugger Interface)

I've looked through couple of articles here such as:

java stack dump on windows

Thread dump programmatically /JDI (Java Debugger Interface) But didnt catch the exact answer.

The problem: There is a Java5 Application on Windows that's runs as a service (so we dont have a console where we are 开发者_JAVA百科able to use Ctrl+Break for Dumping). And sometimes Application hangs and we need a thread dump.

We've tried "jstack" but it doesnt work in our env (we found out that its Java6 only compatible).

So we made a C++ app that calls thread dump via .dll call method attaching to the Java app process, and because of this it needs Local Admin rights, that is not so good.

So we'd like other options that works without admin rights and works with Java 5 without lots of rework of existing code.

Method with Printing in LOOP thread dumps (Thread.getAllStackTraces()) is not an option because we need to refactor lots of applications in order to make it work.

So that just an util that works from "outside" of applications would be a best option.

Thanks in advance!


One option is to dump all the information using jmap, and then analyzing it using other tool.

jmap -dump:format=b,file=<filename>.hprof <jvm_pid>

I am not sure, buy I think it will work on Java 5.

References:

  • HPjmeter-like graphical tool to view -agentlib:hprof profiling output


You can attach to the process with JConsole to detect deadlocks and get stack traces of the threads. For more information, see here: http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html

0

精彩评论

暂无评论...
验证码 换一张
取 消