If you are facing this error after importing an existing maven project into your eclipse IDE, then it means that http-servlet is not available in the project’s class path and you must include it.
Error looks like this.
To include http-servlet into your class path, you have two options:
1) Add target runtime
In this solution, you can add desired server runtime into your application as project facet. As runtime servers have already servlet runtime dependencies, they get included into your project and hence error is gone.
2) Add maven dependency
Another option is include the servlet dependency through maven itself. This will also fix the error.
<dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.5</version> </dependency>
Happy Learning !!