您的位置:首页 > 编程语言 > Java开发

Eclipse中新建Maven Web项目报错:The superclass "javax.servlet.http.HttpServlet" was not found on the Java Bu...

2020-02-03 23:55 609 查看

在maven web项目中的index.jsp中的错误信息如下: 

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

从错误信息可以看出来,找不到该类,也就是说找不到相应jar包。

所以解决方法就是引用相应jar包即可。

 

前提:

需要设置Server Runtime,

Window -> Perferences -> Server -> Runtime Environments -> Add -> Apache Tomcat ... , 这样一步步做下去即可。

 

此问题解决方法:

工程右键 -> Build Path -> Configure Build Path -> Libraries -> Add Library -> Server Runtime -> 选择通过上面上面步骤添加的server即可, 最后点击Apply。

就可以看到jsp页面上的错误消失。

 

但是你还会发现,工程上有一个小红叉,解决如下:

首先查看Markers信息 (Window–>show veiw–>Markers)

错误信息是: 

Project configuration is not up-to-date with pom.xml. Select: Maven->Update Project... from the project context menu or use Quick Fix. 

按提示步骤做即可解决问题!(工程右键 -> Maven -> Update Project)

 

转载于:https://www.cnblogs.com/FocusIN/p/7897035.html

  • 点赞
  • 收藏
  • 分享
  • 文章举报
Ranger1866 发布了0 篇原创文章 · 获赞 0 · 访问量 266 私信 关注
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐