JAVA百度过的异常(1)

时间:2022-01-14 14:20:57

1、---无法解析类型 javax.servlet.http.HttpServletRequest。从必需的 .class 文件间接引用了它

The type javax.servlet.http.HttpServletRequest cannot be resolved. - smartzhaomin的专栏 - CSDN博客
http://blog.csdn.net/smartzhaomin/article/details/19487907

The type javax.servlet.http.HttpServletRequest cannot be resolved. It is indirectly referenced from
required .class files
是缺少serverlet的引用库,解决如下
1.工程右键-properties->java build path
2.在java build path的libraries tab页中选择Add external Jars...按钮
3. 选择eclipse的安装目录,你自己需要根据自己的路径查找添加。E:\eclipse-java-indigo-SR1-win32\eclipse\plugins
选择javax.servlet.jsp_2.0.0.v201101211617.jar;javax.servlet_2.5.0.v201103041518.jar 进行添加即可
注释:由于版本不同,文件包名可能稍有区别。 2、----------------Servlet.init() 异常很累人,本人将jdk1.8降到1.7果然不报此错误
HTTP Status 500 - Servlet.init() for servlet springmvc threw exception

type Exception report

message Servlet.init() for servlet springmvc threw exception

description The server encountered an internal error that prevented it from fulfilling this request.

解决办法:

一:把jdk版本换成1.7 or 1.7以下

二:使用spring 4.0RELEASE及以上版本

3、-----------------

完美解决 未能打开编辑器:Unmatched braces in the pattern. - Terry的IT世界 - CSDN博客
http://blog.csdn.net/hytdsky/article/details/4736462

原因就是语言包的问题 出现这个问题了,配置自己Eclipse的启动参数  eclipse.ini  在最后面加入这段代码   -Duser.language=en

4、----------The superclass javax.servlet.http.HttpServlet was not found on the Java Build Path

错误:HttpServlet was not found on the Java_百度经验--这个是传统项目的做法
  http://jingyan.baidu.com/article/f79b7cb34f40569144023ef9.html

如果是maven项目这需要在 pom.xml里面添加对应的jar包依赖即可。

5、-------------技巧

exlipse同时操作多行。比如同时在多行同列输入相同的文字 - 小爷欣欣 - CSDN博客
http://blog.csdn.net/csdnliuxin123524/article/details/70310175

6、时间0804-------Httpservlet cannot be resolved to a type

Httpservlet cannot be resolved to a type的原因与解决方法 - zhouyingge1104的专栏 - CSDN博客
http://blog.csdn.net/zhouyingge1104/article/details/7583511

Add External JARs--> 选择  把servlet-api.jar 的路径输入即可

7、----- 环境里面报很多异常,头大

    JAVA百度过的异常(1)

8、--------------eclipse中jar包在外面显示

myeclipse项目 往lib里导jar包,全乱了在外面 与SRC同一目录 怎么解决_百度知道
https://zhidao.baidu.com/question/2117740880786239107.html

    JAVA百度过的异常(1)

9、---- Junit Test中不可以用注解 注入bean,用传统方式获取bean

  java junit 使用注解引入 - huaishuming的专栏 - CSDN博客--碰到的问题此文章一样,但是我看不懂他的解法。囧
  http://blog.csdn.net/huaishuming/article/details/41212147

public class DscVehicleTest2 {
private ApplicationContext applicationContext;
//@Autowired 这里注入有问题,在Test函数里面注入也不行
private DscVehicleMapper dscVehicleMapper;
@Before
public void setUp() throws Exception {
applicationContext = new ClassPathXmlApplicationContext("classpath:spring/applicationContext-dao.xml");
dscVehicleMapper = (DscVehicleMapper) applicationContext.getBean("dscVehicleMapper");
}
@Test
public void test1() {
DscVehicle dscVehicle = dscVehicleMapper.selectByPrimaryKey(5L);
System.out.println(dscVehicle);
}
}