javaintellij-ideatomcatservletsremote-debugging

How to debug the Tomcat Catalina engine


When I tried doing research on this, everything I found was how to debug an application running under Tomcat. I'm trying to debug Tomcat itself, because something strange is happening that I can't explain.

When I attach to my Tomcat instance and run inside of IntelliJ, it will debug the Spring Framework code, but then when it calls forward on org.apache.catalina.core.ApplicationDispatcher, stepping into doesn't act like it knows where to go until it gets back down to Spring Framework.

I made the assumption that tomcat was shipped with debugging removed for performance reasons. I downloaded the source and built it with debug turned on and ran that one, yet IntelliJ behaves exactly the same way.

Can someone explain why and how I go about debugging into Tomcat itself?


Solution

  • Add catalina.jar

    Just after posting this, it occurred to me that Tomcat doesn't have access to the actual JAR file.

    So, I copied the catalina.jar file into my project, added as library. Now I can step through the code, just like everything else.