I had the same problem because my "Dynamic Web Project" had no reference to the installed server i wanted to use and therefore had no reference to the Servlet API the server provides.
Following steps solved it without adding an extra Servlet-API to the Java Build Path (Eclipse version: Luna):
- Right click on your "Dynamic Web Project"
- Select Properties
- Select Project Facets in the list on the left side of the "Properties" wizard
- On the right side of the wizard you should see a tab named Runtimes. Select the Runtime tab and check the server you want to run the servlet.
Edit: if there is no server listed you can create a new one on the Runtimes tab