Is there any way to debug web applications using Eclipse?
I am working on a web application using the Eclipse Java IDE.
I am using Tomcat 6 as my servlet container.
The tools available for Java, inculding Eclipse, seem to lack debugging capabilities for web applicatons (as compared to Visual Studio for the .NET pla开发者_如何转开发tform).
How can I debug my web app using Eclipse?
run tomcat in debug mode (java option -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000
) and then use remote debug in Eclipse (Debug Configurations -> Remote Java Aplication) and connect to server on configured port (e.g. 8000 in this example).
If you want to debug your web application, set breakpoints where desired and run Tomcat on debug mode. If you logged your exceptions or placed INFO
/DEBUG
messages, you can view them on Console
(if ConsoleAppender
is used).
The essential thing is that your application runs on debug mode. For browser side debugging (as @Thomas said), there's tools like Chrome Debugger (for Google Chrome), Firebug (for Firefox) and Firebug Lite (for other browsers).
You can add breakpoint in you code and deploy the application in debug mode.
Eclipse has a console window where you can see the error messages generated. For the web there are an add ons or built on the browser like firebug for Firefox and Google-chrome developers-tools. Try too look on it.
精彩评论