java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderServlet服务器启动报异常
来源:互联网 发布:iphone写日记的软件 编辑:程序博客网 时间:2024/06/05 21:54
今天配置的Tomcat服务器,启动springMVC项目,报Java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderServlet异常,还有异常:java.lang.ClassNotFoundException:org.springframework.web.context.ContextLoaderServlet等异常,解决问题网上查了很多资料,特意总结如下:
情况1:
WebApplicationContext wctx=WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
我的spring-web.jsr的包已经加上了,为什么程序运行时,找不到WebApplicationContextUtils类呢?
有一个教程上说了这样的一句话,我不理解是什么意思“在Action初始化时获得一个应用程序上下文。重用spring的WebApplicationContextUtils类,如果没有可用的上下文,该动作不会正确的初始化”。
情况2:
就是你的项目可能经过clean以后,部署项目时项目没有自动编译成.class文件,右键单击项目-build project,进行手动编译
情况3:
spring框架有自已内在一套映射机制,楼主的问题是由于没有找到相应的映射BEAN引用而产生!
<context-param>
<param-name>contextconfiglocation</param-name>
<param-value>com/test/servlet.xml</param-value>
</context-param>
情况4:
你用的是hibernate3.0吧! 但你的spring配置文件中不是
<bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
应该是:
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
你试试!
情况5:
关键字: Spring与Web应用集成的方法细讲
1、将spring的相关jar包,拷贝到web应用的WEB-INF/lib目录下
2、修改web.xml,让应用服务器自动加载spring的BeanFactory对象
3、在web组件里,可以使用WebApplicationContextUtils工具类来 获得BeanFactory对象的实例,拥有了BeanFactory对象,就拥有 了spring的容器管理的能力。
解释:
这种配置的结果是,spring通过ContextLoaderListener将WebApplicationContext对象
(BeanFactory的子类)放入ServletContext中,并取名为一个静态变量的值:
WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE
* 通过WebApplicationContextUtils.getApplicationContext()方法就可以获得WebApplicationContext
对象的值
* 或者通过request.getSession().getServletContext().getAttribute(WebApplicationContext.ROOT_WEB_APPLICAT
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderServlet服务器启动报异常
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderServlet服务器启动报异常
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderServlet
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderServlet
- Tomcat 启动报java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener 异常
- 解决maven管理下,java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderServlet
- maven项目 报:java.lang.ClassNotFoundException: org.springframework.web.context...
- javaweb启动java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- 启动报错:java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- 启动报错:java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- Eclipse启动报错:java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- maven创建spring项目之后,启动报错java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoade
- 启动报错:java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- maven项目 启动报错: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工程启动报错:maven 项目出现 java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoad
- 启动报错:java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- Android为什么不允许在子线程中访问UI?
- 关于百度地图导航退出unregisterReceiver异常
- opencv实现最基本的图像配准
- Java并发编程-同步辅助类之Exchanger
- 二叉树的中序遍历(非递归)
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderServlet服务器启动报异常
- 游戏服务登录流程
- http://mp.weixin.qq.com/s?__biz=MzAwODMyNjYxMQ==&mid=502716191&idx=1&sn=e916fa1a45fe91d162e1e71a2689
- 理解Window和WindowManager
- jQuery.Autocomplete实现自动完成参数详解
- Android设计模式-建造者模式
- GDB 远程调试Linux (CentOS)
- Linux之文件系统的开机挂载
- error C2593: “operator +=”不明确