idea 远程调试

http://www.jroller.com/JamesGoodwill/entry/debugging_web_application_with_intellij


03:02PM Jun 15, 2006 in category Java by James Goodwill

I have been asked about remote debugging using IntelliJ and Tomcat several times. So I thought I would make it easy on myself and everyone else by posting it as a blog. There are several ways to debug an application running in Tomcat, but I have always found it easier and more useful to debug web applications using IntelliJ's remote debugging tools. It more realistically emulates the real environment and it is easy to debug clustered applications. So anyway, when connecting to Tomcat using IntelliJ you need to complete the following steps:
  1. Select the Run and then Edit Configurations menus.
  2. When the Run/Debug Configurations dialog box appears, select the Remote tab, and click the plus (+) symbol on the left side of the dialog box. This creates an Unnamed configuration.
  3. Enter the value Tomcat for the name. The other settings will vary depending on whether you are running Tomcat in Windows or UNIX. With UNIX, set the Port value to 8000. The remaining values can remain at their default.

    Note: You can specify the host to connect to. If you have access to the port and the process is running on another machine, then you can debug the process remotely. This works out really well for those situations where the application works fine in your local environment but not in the test environment.



  4. If the JPDA_ADDRESS is something other than 8000, make the appropriate change to the Port input box.
  5. If you use Windows and did not change the default catalina.bat script settings, select the Shared Memory option, and set the Shared memory address to Tomcat's default, jdbconn.
  6. If you have not already launched Tomcat in debug mode, do so now with the following (depending upon your OS):
    $CATALINA_HOME/bin/catalina.sh jpda start
    
    $CATALINA_HOME/bin/catalina.bat jpda start
    
  7. Once Tomcat is up and running, go back to IntelliJ and either click the Debug button or select the Run->Debug menus items. You should new see a Debug-Tomcat message window with the message "Connected to the target VM at 'localhost:8000' using socket trans-port" or a similar message in Windows.
That is it. You can now set a breakpoint in your deployed web application and start debugging.

你可能感兴趣的:(idea 远程调试)