The superclass “javax.servlet.http.HttpServlet” was not found on the Java Build Path

前端 未结 17 1792
醉话见心
醉话见心 2020-12-24 02:32

I\'m a beginner and learning spring and hibernate (utilizing maven in project)and came across this problem and got stuck here. tried finding solution but ended up no where.

相关标签:
17条回答
  • 2020-12-24 03:06

    add servlet-api jar file which is present in the lib folder under tomcat folder. You can do this as follows Project -> properties -> java build path -> under libraries click add external jars after that go to project -> clean -> build all. this worked for me.

    0 讨论(0)
  • 2020-12-24 03:08

    Project Properties -> Java Build Path -> in the libraries Select "Classpath" -> Add Library -> Select "Server Runtime" from the list -> Next -> Select "Apache Tomcat" -> Finish

    0 讨论(0)
  • 2020-12-24 03:10

    Add servlet-api.jar file which is present in the lib folder under tomcat folder. You can do this using the following steps:

    1.Select project properties
    2.Select Java Build Path
    3.Select Libraries
    4.Select External Jars
    5.Select servlet-api.jar
    6. Apply & Ok.

    The issue should be resolved after these steps.

    0 讨论(0)
  • 2020-12-24 03:11

    Try This - Add Tomcat at run time

    0 讨论(0)
  • 2020-12-24 03:13

    For an Ant project:

    Make sure, you have servlet-api.jar in the lib folder.

    For a Maven project:

    Make sure, you have the dependency added in POM.xml.

    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <version>3.1.0</version>
      <scope>provided</scope>
    </dependency>
    

    Another way to do it is: Update the project facets to pick up the right server.

    Check this box in this location:

    Project → Properties → Target Runtimes → Apache Tomcat (any server)

    0 讨论(0)
  • 2020-12-24 03:16

    Your system can have many different tomcat versions. You can try to solve it.

    Right Click on Project then Select Properties, Select Project Facets and on the right section, Select right Apache Tomcat versions as Runtimes and click ok

    0 讨论(0)
提交回复
热议问题