开发者

How do we generate stack trace in TOMCAT?

开发者 https://www.devze.com 2023-02-05 17:40 出处:网络
How do we generate stack trace in TOMCAT? My real problem is TOMCAT just stops after doing some funct开发者_JAVA技巧ion call defined in some library.

How do we generate stack trace in TOMCAT? My real problem is TOMCAT just stops after doing some funct开发者_JAVA技巧ion call defined in some library. It would be easy to debug with a stacktrace.


There's multiple things you can do. I'm assuming below you are talking about a Java stack trace.

In linux, you can generate a stack trace at any time by doing a kill -3 command

ps aux | grep tomcat --> gives you the process number

kill -3 1000 --> where 1000 is the process number

In Windows, right click on the Tomcat service icon in the system task tray and choose "Thread dump".

If you want to generate a stack trace at a particular point in the code

Throwable t = new RuntimeException();
t.printStackTrace();

All of the above will send a stack trace to standard out.

Finally, you can run a profiling program like VisualVM and see the stack trace for any given thread while the program is running.

0

精彩评论

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

关注公众号