Debugging Tomcat classes


In the Debug side window all the stack frames are shown in the Frames window. Specifically while debugging using a Local Tomcat debug configuration:

  • From HttpServlet onwards the frames have a yellow background and clicking on any of these shows the point of execution in that frame.
  • Less nested frames corresponding to Tomcat classes have a white background. Even though line numbers are shown and debug information is visible clicking on any of these frames never shows the corresponding line number, even if sources for the Tomcat are attached.

How do I debug the Tomcat code itself? I know I can run Tomcat from the Bootstrap using an Application configuration but then I'd lose the automatic rebuilding of my webapp.

Comment actions Permalink

It works for me if sources are attached to Tomcat in Settings | Application Servers.
Please make sure that version of sources matches to version of Tomcat.

Nikolay Chashnikov
Software Developer
JetBrains, Inc
"Develop with pleasure!"

Comment actions Permalink

I'm not getting tomcat to step into catalina.jar. I've downloaded the 6.0.35 sources and jar'd the files:

jar cvf servlet-api-6.0.35-src.jar javax/
jar cvf catalina-6.0.35-src.jar org/

And then attached the sources to my Tomcat debug instance. I can step into the servlet-api-6.0.35-src.jar but it won't show either the class or java files for the catalina classes (e.g, org.apache.catalina.*) though it does show line numbers, which do correspond to the correct source line numbers.

This is on IntelliJ 11.0.2 on OSX (10.7.3) with java 1.6.0_29.

What can I do to make this work?
Comment actions Permalink

For future reference: adding the sources to the application server did not work for me either (IntelliJ Ultimate 2019.1.3).


What did work was to add a library in the project settings (File -> Project Structure, then Libraries). Add a library, and only add the source files for Tomcat. Make sure to select the "java" folder in the set of files(!). Then add the library to your main module(s).



Please sign in to leave a comment.