It's not a secret anymore!
The moose likes IDEs, Version Control and other tools and the fly likes IntelliJ debug with Tomcat 5 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "IntelliJ debug with Tomcat 5" Watch "IntelliJ debug with Tomcat 5" New topic

IntelliJ debug with Tomcat 5

Hussein Baghdadi
clojure forum advocate

Joined: Nov 08, 2003
Posts: 3479

I have a web application developed with Hibernate, Spring and WebWork.
I want to set some break points inside my WebWork actions and step through them while the application is running under Tomcat.
How to set up that ?
I read IntelliJ docs but there are alot of things I don't understand.
What is Local and Remote ?
How to run Tomcat in debug mode ?
Would you mind writting a little items of required steps ?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17417

Remote debugging is when the JVM opens a tcp/ip network port which a debugger uses to communicate with the JVM. It's considered "local" debugging by IntelliJ if the program being debugged is on the same host, but the communications is still over tcp/ip ports, just internal ones.

Normally, when IntelliJ debugs a tomcat app, it launches an embedded Tomcat and connects via the debugging port. You have the option of "parking" the app to give you time to set breakpoints before actually launching it, or of going straight into the app and setting breakpoints as needed. Setting breakpoints in IntelliJ is as simple as clicking in the border area to the left of the displayed source code line. A "bullet" will appear to indicate the breakpoint. More complex breakpoints can also be made (such as only when certain tests are true), but the idea (no pun intended ) is the same.

For debugging a simple, single webapp, local debugging is enough. If you have a more complex setup, such as client-server testing, 2 webapps running together, or other situations where more than one app is running at a time, remote debugging is required. If you look in the TOMCAT_HOME/bin directory, I think the comments on the Tomcat scripts indicate how (and on which port) to get Tomcat into remote debugging operation - you have to indicate at JVM startup if you want debugging.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: IntelliJ debug with Tomcat 5
It's not a secret anymore!