您的位置:首页 > 其它

idea 远程调试

2014-08-15 16:54 183 查看
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:

Select the Run and then Edit Configurations menus.
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.
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.

If the JPDA_ADDRESS is something other than 8000, make the appropriate change to the Port input box.
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.
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


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.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: