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

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

    
      javax.servlet
      javax.servlet-api
      3.1.0
      provided
    
    

    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)

提交回复
热议问题