ssh项目导入报the import javax.servlet cannot be resolved
在做javaWeb项目时,我们经常会出现丢失包的情况,如下图所示的错误,我们应该怎么解决呢?
根据网上教程向工程中加入tomcat的servlet-api.jar和jsp-api.jar的包

此时项目确实不会报错了,但是更坑的报错出现了;运行项目发现
严重: Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
at org.apache.jsp.index_jsp._jspInit(index_jsp.java:23)
at org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:52)
at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:164)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:340)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:620)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:745)
然后百度一顿搜索;查找到的原因是jsp-api.jar包与tomcat下的jsp-api.jar包冲突,要移除冲突的包;然后就去找WEB-INF下面的包,没发现这两个包啊,确实是很奇怪;
后面认真查看项目的结构,问题终于找到了;发现少了 JAVA EE5 Libraries系统包;而servlet-api.jar和jsp-api.jar在JAVA EE5 Libraries包下,直接使用javaee5 library的包即可;
解决方法
引入 JAVA EE5 Libraries系统包,并查找.classpath文件中查看是否有servlet-api.jar和jsp-api.jar这两个包的加载配置,如果有的话就删除即可
最重要的一点 一定要clean下项目,不然不起作用。
ssh项目导入报the import javax.servlet cannot be resolved的更多相关文章
- 引入工程报包导入异常:import javax.servlet.annotation.WebFilter;
引入工程报包导入异常:import javax.servlet.annotation.WebFilter; (2013-02-21 16:38:00) 分类: java 今天上午导入了一个项目,用 ...
- 项目导入之后报错:The import javax.servlet cannot be resolved
项目导入之后报错:The import javax.servlet cannot be resolved 解决方法:在Eclipse中,右击项目,选择Build Path->configure ...
- 【转】The import javax.servlet cannot be resolved
转载地址:http://www.2cto.com/kf/201212/176868.html 今天将别人的项目导入eclipse之后,出现了“The import javax.servlet cann ...
- The import javax.servlet cannot be resolved
在STS中,突然把配置的Tomcat删除,换另外一个Tomcat使用时,出现:The import javax.servlet cannot be resolved.这个错误可能是服务器自带的serv ...
- 解决 jsp eclipse异常 【The import javax.servlet cannot be resolved】
[ <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 报错][impor ...
- The import java.util cannot be resolved The import javax.servlet cannot be resolved
The import java.util cannot be resolved 原因:这是由于你的项目buildpath不对 解决方案:右键项目-------buildpath--------最下面那 ...
- Maven 建立web项目 The import javax.servlet cannot be resolved
右击项目,选择Java Build Path->Libraries->Add External JARs,tomcat的路径lib文件夹下选中"servlet-api.jar&q ...
- Myeclipse开发环境下文件中出现的提示错误与解决方法:The import javax.servlet cannot be resolved?
1.开发工具:MyEclipse 2.右击项目 >> Build Path >> Add External Archives (Tomcat >> li ...
- 在Eclipse中编写servlet时出现"The import javax.servlet cannot be resolved" 问题解决办法
在Eclipse中,project->properties,选择Java Build Path->Libraries->Add External JARs,找到你计算机中tomcat ...
随机推荐
- spring boot 的使用(一)
1. 启动spring-boot项目 mvn spring-boot:run cd target java -jar xxxx.jar xxxx代表生成的jar包
- nginx 4 win10
去下载文件 http://nginx.org/en/download.html 然后释放文件到一目录 最后执行nginx.exe.到浏览器查看localhost,界面: 在最后,别忘了,修改其80端口 ...
- 【Codeforces 1096D】Easy Problem
[链接] 我是链接,点我呀:) [题意] 让你将一个字符串删掉一些字符. 使得字符串中不包含子序列"hard" 删掉每个字符的代价已知为ai 让你求出代价最小的方法. [题解] 设 ...
- [置顶]
Linux学习总结(20)——Linux 文件夹结构和作用
/bin 二进制可执行命令 /dev 设备特殊文件 /etc 系统管理和配置文件 /etc/rc.d 启动的配置文件和脚本 /home 用户主目录的基点,比如用户user的主目录就是/home/us ...
- poj 1364 查分约束
#include<stdio.h> #include<iostream> #include<stack> #include<string.h> usin ...
- 【6572】关于mtk平台display模块的学习探讨
现在在学习mtk的display subsystem,有遇到流程上不太清楚地地方想要询问: 1.cmd模式和video模式framebuffer如何更新, 以及两种模式的差异? cmd和video m ...
- Parallelized coherent read and writeback transaction processing system for use in a packet switched cache coherent multiprocessor system
A multiprocessor computer system is provided having a multiplicity of sub-systems and a main memory ...
- Linux下汇编语言学习笔记76 ---
这是17年暑假学习Linux汇编语言的笔记记录,参考书目为清华大学出版社 Jeff Duntemann著 梁晓辉译<汇编语言基于Linux环境>的书,喜欢看原版书的同学可以看<Ass ...
- 条款50: 提高对C++的认识
class Base { public: virtual void f(int x); }; class Derived: public Base { public: virtual void f(d ...
- 如何快速查看EPS,AI等矢量文件
使用Adobe Bridge可以快速查看所有这些格式的资源 查看EPS格式图片: 查看AI格式: 某些AI文件则无法预览(此外还有一些CDR的格式) 相比之下,ACDSee的效果则不如Adob ...