How to debug servlet using Eclipse

Right-click on project -> Debug as -> Debug on server should do the trick


First ensure that you're using "Eclipse IDE for Enterprise Java Developers", with the Enterprise in its name, and thus very definitely not just "Eclipse IDE for Java Developers".

Once ensured/upgraded, put breakpoints in the servlet code the usual way and run the server in debug modus. Rightclick the server in Eclipse and choose Debug instead of Start (or click the bug button instead of the green arrow on the button panel of the servers view). Then fire a HTTP request on the servlet using your favourite webbrowser. Eclipse will open and focus the debug panel when the particular code line with the breakpoint is about to be executed.