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 !!
All of my websites are hosted on Bluehost. Why? Because they make it incredibly easy to get a new site up and running with their one-click automatic WordPress Blog installation.
You can use your Bluehost account to host multiple domains—no need to pay more for hosting when you’re ready to start another website.