How do we generate stack trace in TOMCAT? My real problem is TOMCAT just stops after doing some function 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With