Remote debugging with Tomcat (7) and Intellij
It took me a while to find out how to set up Tomcat 7 to allow for remote debugging from Intellij, so I decided to put the process up here for my own future reference and hopefully for other people's convenience. This small tutorial is aimed at Windows users, but it shouldn't be too difficult to figure out how to do it on Linux.
Configuring Tomcat 7
Follow these steps to configure Tomcat.
- Go to your Tomcat installation directory and then into the bin folder.
- Create a new file called setenv.bat. (This file will be automatically read by catalina.bat)
- Add the following content to setenv.bat:
set CATALINA_OPTS="-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n"
I chose the default port number for remote debugging, which is 8000, but you can choose any port number you like. - Now start Tomcat normally, using startup.bat. The first thing Tomcat should tell you is that it is listening on port 8000.
Now that Tomcat is ready for debugging let's see how to create a debugging configuration in Eclipse and Intellij.
Ecplise
1.Open Debug Dialog
Remote Java Application
new Project :