java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderL
来源:互联网 发布:数据统计分析师 编辑:程序博客网 时间:2024/06/09 20:50
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderL
- 博客分类:
- spring
WebJavaSpringEclipseTomcat
今天学习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便能顺利通过了。
3 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
- AbstractProtocol泛型抽象类
- 选择器的使用
- 砍树问题
- uva 825 Walking on the Safe Side
- Android开发:申请微信AppID的MD5(数字签名)格式bug
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderL
- 常用linux命令
- C#索引器
- Virtualbox虚拟机网络配置(NAT + Host-only - Bridged)
- FZU Problem 2104 Floor problem (数学啊 )
- Python 第二章 列表和元组(3) 列表
- 电脑无盘启动系统方案(by 星空武哥)
- 学习笔记No.4
- Java中Vector和ArrayList的区别