java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderL
今天学习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便能顺利通过了。
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderL的更多相关文章
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderL,spring获取context
今天学习spring项目的时候出现了下面的错误信息: java.lang.ClassNotFoundException: org.springframework.web.context.Context ...
- jeesite 经常出现java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderL解决思路
本来jeesite是用的maven,但是我开发的项目用这个框架没用maven, 经常报这个错,我能用的办法就是将springmvc—web.jar包删掉,然后重新添加
- 部署Maven项目到tomcat报错:java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderLi
Maven项目下update maven后Eclipse报错:java.lang.ClassNotFoundException: ContextLoaderL 严重: Error config ...
- 真正解决问题:maven eclipse tomcat java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener--转
原文地址:http://www.cnblogs.com/amosli/p/4067665.html 在使用eclipse进行整合springmvc时经常会碰到这样的异常: java.lang.Clas ...
- maven 项目启动tomcat报错 java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
maven项目启动tomcat报错: java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderLi ...
- ssh项目java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoade错误
错误: 导入别人的ssh项目后出现java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoade错误, 错 ...
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
参考: http://www.cnblogs.com/sunxucool/archive/2013/06/07/3124380.html ---------------------------&g ...
- 真正解决问题:maven eclipse tomcat java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
在使用eclipse进行整合springmvc时经常会碰到这样的异常: java.lang.ClassNotFoundException:org.springframework.web.context ...
- springmvc项目中java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener 严重: Error co ...
随机推荐
- ML(4.3): R Random Forest
随机森林模型是一种数据挖掘模型,常用于进行分类预测.随机森林模型包含多个树形分类器,预测结果由多个分类器投票得出. 决策树相当于一个大师,通过自己在数据集中学到的知识对于新的数据进行分类.俗话说得好, ...
- Elasticsearch 基础入门
原文地址:Elasticsearch 基础入门 博客地址:http://www.extlight.com 一.什么是 ElasticSearch ElasticSearch是一个基于 Lucene 的 ...
- PLSQL使用SCN码恢复误删表数据
#查询数据库当前的SCN码select current_scn from v$database 1250494 #将当前的SCN码减小后,根据SCN码查询误删数据表的数据情况#直至找到被删的数据为止s ...
- POJ 2706 Painter
Painter Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 3157 Accepted: 1962 Descripti ...
- sklearn中的metrics模块中的Classification metrics
metrics是sklearn用来做模型评估的重要模块,提供了各种评估度量,现在自己整理如下: 一.通用的用法:Common cases: predefined values 1.1 sklearn官 ...
- BCGcontrolBar(一) MFC界面库简介
原帖地址:http://blog.csdn.net/zw514159799/article/details/9148385 英文原文:http://www.bcgsoft.com/bcgcontrol ...
- STL容器能力一览表和各个容器操作函数异常保证
STL容器能力一览表 Vector Deque List Set Multiset map Multimap 典型内部 结构 dynamic array Array of arrays Doubly ...
- python 9*9示例
# 9*9 乘法表# def nine_nine():# for i in range(1, 10):# for j in range(1, i+1):# ...
- Dance GAN 迁移不同视频中人物动作的方法
该研究提出一种迁移不同视频中人物动作的方法.给出两个视频,一个视频中是研究者想要合成动作的目标人物,另一个是被迁移动作的源人物,研究者通过一种基于像素的端到端流程在人物之间进行动作迁移(motion ...
- ORA:01745 无效的主机 绑定变量名
原因是:mybatis中的mapping映射时,sql语句中忘了加逗号,且逗号处有换行