There are two solutions in this essay, and the other is a third one in the passage, please click here
1. Error
This is an error message: Thesuperclass "Javax.servlet.http.HttpServlet" is not found on the Java Build Path
2. Error Analysis:
I was thinking about the lack of a web container, the servlet container.
So I added the Tomcat plugin to the Pom.xml file:
1 <Plugins>2 <plugin> 3 <groupId>Org.apache.tomcat.maven</groupId>4 <Artifactid>Tomcat7-maven-plugin</Artifactid>5 <version>2.2</version>6 <Configuration>7 <Port>8050</Port>8 <Path>/</Path>9 </Configuration>Ten </plugin> One </Plugins>
But the problem is not solved, or reported the same mistake.
3.1 Solutions
Then try adding the following in the Pom.xml file:
1 <Dependency>2 <groupId>Javax.servlet</groupId>3 <Artifactid>Servlet-api</Artifactid>4 <version>2.5</version>5 <Scope>Provided</Scope>6 </Dependency>7 <Dependency>8 <groupId>Javax.servlet</groupId>9 <Artifactid>Jsp-api</Artifactid>Ten <version>2.0</version> One <Scope>Provided</Scope> A </Dependency>
The error is resolved.
3.2 Then tried to delete the Tomcat plugin from the Pom.xml file, and the project still had no problem.
Then he tried to delete the Servlet.api and Jsp-api in the Pom.xml file.
Then right-click on the project-->build path-->add libraries-->server Runtime ...
can also solve the problem, the project does not error.
4. Analyze 3.1, 3.2 two solutions:
Adding the Tomcat plugin to the Pom.xml file does not rely on the SERVLET-API and Jsp-api, so you also need to manually rely on the two jar packages.
But by right-clicking on the project-->build path-->add libraries-->server Runtime ... The way to add Tomcat will also depend on the Servlet API and the Jap API.
5. There is also a third solution
Please click here to view my other essay.
The superclass "Javax.servlet.http.HttpServlet" is not found on the Java Build Path II