java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderL
来源:互联网 发布:广州数据恢复 编辑:程序博客网 时间:2024/06/01 09:37
原Blog:http://blessht.iteye.com/blog/1104450
今天学习spring+cxf的时候遇到一个问题:在web.xml中配置了spring的上下文监听器:
- <listener>
- <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
- </listener>
随后启动tomcat服务器,控制台提示如下错误:
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
这种错误意思很明确:找不到“ org.springframework.web.context.ContextLoaderListener”这个类,ContextLoaderListener这个类是在spring-web.jar包下,我仔细检查了项目jar环境,发现该jar包确实存在,而且也能找到编译后的ContextLoaderListener.class文件。
当时很疑惑,随后去网上找答案,终于发现问题根源:
- Java虚拟机是根据Java ClassLoader(类加载器)决定如何加载Class。
- 系统默认提供了3个ClassLoader
- Root ClassLoader,ClassPath Loader,Ext ClassLoader
- 我们也可以编写自己的ClassLoader,去加载特定环境下的Jar文件。
- 能不能加载Jar,加载哪里的Jar,是由ClassLoader决定的。
- 楼主的问题可能是 导入的仅仅是jar包的引用,例如在eclipse中通过build path加进user lib……(类似快捷方式)
- 这种在Java Application中没问题,但在web Application中可能会出现找不到类的异常。
- 在WEB Application中jar包最好放在webroot或webcontent下的lib文件夹内,特别是xml中用到的jar包。
因为我是通过eclipse的build path直接引用的jar包,没有把jar文件拷贝到lib目录下。
随后我将所需的jar包全部拷贝到WEB-INF/lib下,再重新启动tomcat便能顺利通过了。
0 0
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderL
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderL
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderL
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderL
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderL,spring获取context
- 关于intellij加载spring框架java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderL
- (转)问题java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderL
- idea调试SpringMvc, 出现:java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderL
- java.lang.ClassNotFoundException: org.springframework.web.context.Contb.context.
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener 问题原因。
- 关于java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderServlet
- 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...
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- 静态成员函数不能用const修饰 ,也不能存取nonstatic数据
- 汉诺塔计数
- 郑州哪个医院治肝病比较好
- sizeof与strlen使用常见问题
- 大素数判定,大整数因式分解模板 HDU 4910
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderL
- Xdoclet + Ant自动生成Hibernate配置文件
- 对象和表之间的关系
- Oracle数据库导入和导出以及出现的问题
- Percona XtraBackup User Manual
- 黄璐_对NFV和SDN的思考与实践
- android AsyncTask介绍
- Struts2源码阅读(五)_FilterDispatcher核心控制器
- java将多个文件一起打成zip包后下载实例