idea 中maven 编译报找不到javax.servlet.ServletException的类文件

xiyuan1223 2017-02-28 07:01:38
如题,我也尝试通过settings把servlet-api.jar引入,但好像没什么用

[ERROR] /E:/test/gitRepo/SpringMvc/src/main/java/spitter/config/SpittrWebApplication.java:[8,8] 无法访问javax.servlet.ServletException
找不到javax.servlet.ServletException的类文件
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.837 s
[INFO] Finished at: 2017-02-28T18:51:36+08:00
[INFO] Final Memory: 14M/168M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project SpringMvc: Compilatio
n failure
[ERROR] /E:/test/gitRepo/SpringMvc/src/main/java/spitter/config/SpittrWebApplication.java:[8,8] 无法访问javax.servlet.ServletException
[ERROR] 找不到javax.servlet.ServletException的类文件
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException



...全文
1904 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
yaoliyun1 2019-09-01
  • 打赏
  • 举报
回复
[解决了,原来maven编译时从jre中加载servlet包,只要下载相应servlet-api.jar包到jre->lib->ext中即可
怕乌龟骑 2018-01-12
  • 打赏
  • 举报
回复
引用 1 楼 xiyuan1223 的回复:
解决了,原来maven编译时从jre中加载servlet包,只要下载相应包到jre->lib->ext中即可
正解!谢谢楼主~
xiyuan1223 2017-02-28
  • 打赏
  • 举报
回复
解决了,原来maven编译时从jre中加载servlet包,只要下载相应包到jre->lib->ext中即可

5,655

社区成员

发帖
与我相关
我的任务
社区描述
Web开发应用服务器相关讨论专区
社区管理员
  • 应用服务器社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧