【原创】java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
2012-11-04 08:54
671 查看
Exception:
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderServlet
Description:
在进行Struts和Spring整合的时候,需要在web.xml中设置ContextLoaderListener,通过ContextLoaderListener来加载
spring的配置信息,提前初始化ApplicationContext。这样在程序里只要通过
WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext)
就可以得到applicationContext对象。
结果发生上面的异常,信息很直白,找不到我配置的ContextLoaderListener,可是我明明在build path中添加的spring-web-1.2.6.jar,不可能报错,很疑惑????
Accuse:
百度一下,找到一篇博文:http://blog.csdn.net/xingfuzhijianxia/article/details/6433918里面列举了发生这个错误的几种情况,第二种是通过引用形式导入的jar,而不是拷贝到WEB-INF/lib下,尝试一下结果完全正确,100%雷到。
详细原因参考:【原创】jar包直接拷贝到WEB-INF/lib下和以userLibrary引入的区别
Extension:
以后如果发生已经导入jar包,可仍找不到相应类,首先考虑导入jar包的形式是什么,拷贝lib下要比普通引用要安全多。
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderServlet
Description:
在进行Struts和Spring整合的时候,需要在web.xml中设置ContextLoaderListener,通过ContextLoaderListener来加载
spring的配置信息,提前初始化ApplicationContext。这样在程序里只要通过
WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext)
就可以得到applicationContext对象。
结果发生上面的异常,信息很直白,找不到我配置的ContextLoaderListener,可是我明明在build path中添加的spring-web-1.2.6.jar,不可能报错,很疑惑????
Accuse:
百度一下,找到一篇博文:http://blog.csdn.net/xingfuzhijianxia/article/details/6433918里面列举了发生这个错误的几种情况,第二种是通过引用形式导入的jar,而不是拷贝到WEB-INF/lib下,尝试一下结果完全正确,100%雷到。
详细原因参考:【原创】jar包直接拷贝到WEB-INF/lib下和以userLibrary引入的区别
Extension:
以后如果发生已经导入jar包,可仍找不到相应类,首先考虑导入jar包的形式是什么,拷贝lib下要比普通引用要安全多。
相关文章推荐
- 项目起不来 java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener 错误处理办法
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- Tomcat 启动报java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener 异常
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- tomcat启动报错:java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- maven 项目出现 java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- SSH框架问题——java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener报错
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener错误的问题的原由
- 【web.xml】报错java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- 启动报错:java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- java.lang.ClassNotFoundException:org.springframework.web.context.ContextLoaderListener问题解决
- Maven导入工程以后报java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener