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

前端 未结 17 1794
醉话见心
醉话见心 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:28

    I too received the same error as quoted below:

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

    I followed these steps to resolve the issue:

    1. Right Click on Project
    2. Select Properties
    3. Select Project Facets
    4. Select Apache Tomcat as Runtime server
    5. Click OK
    0 讨论(0)
  • 2020-12-24 03:29

    for maven project , you should add this dependency

    <dependency>
                <groupId>javax</groupId>
                <artifactId>javaee-web-api</artifactId>
                <version>6.0</version>
                <scope>provided</scope>
    </dependency>
    
    0 讨论(0)
  • 2020-12-24 03:31

    Adding the Tomcat server in the server runtime will do the job:

    Right click your project and than;

    Project properties → Target Runtimes → Select/Check "Apache Tomcat" → Finish.

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

    I had this same issue and a couple others being reported for a existing maven project.

    I had the proper dependencies in place and I could see the jar under maven dependencies, however the project was improperly brought into eclipse.

    I ended up having to delete the project, clone from git again then do an import of the project as an existing maven project.

    This solved the issue in this thread and several others issues I was having. More details on solution can be found here: Maven Project in Eclipse `org.springframework cannot be resolved to a type` from target path

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

    I faced the same error. Adding the tomcat server in the runtime environment will solve the error:

    Right click on your project -> Properties -> Targeted runtimes -> Select apache tomcat server -> click apply -> click ok.

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