Tuesday, September 3, 2002 03:51 PM
In order to debug a servlet/JSP app you'll need to attach the IDEA debugger to a port on the machine running your app. Basically, the code executes on the remote machine, sends the debug information through a port, which your debugger is attached to.
The first step is to configure your app server to put debug information out to a port. This is done by specifying several properties for the JVM. Add these properties to the java.exe command line call int eh Tomcat configuration:
-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=9009,server=y,suspend=n
This instructs your app server to send debugging information out to port 9009. You would then configure IntelliJ to attach to a remote port:
- Click the "Remote" tab.
- Click the "+" button to add a new app.
- Select "Socket" as the transport.
- Enter the host (the machine running the web app) and port (9009 in our case)
- Uncheck "Compile modified before..."
- Click the "Debug" button.
IDEA will not attempt to connect to the port you specified. Set a break point in one of your servlets, then load the servlet in a browser. The debugger should come up on the breakpoint.