no ContextLoaderListener registered的解决方法
来源:互联网 发布:网络维护教程 编辑:程序博客网 时间:2024/06/05 09:15
查了很多资料,有不同的说法,我总算是解决了
说法1:
spring中提供 ContextLoaderListenter类,用来加载context的xml文件。
spring为struts提供ContextLoaderPlugIn类,此类也可以加载context的xml文件。
区别在于,两种方式加载的WebApplicationContext,以不同的Key存放在ServletContext中。而如果你定义了HibernateFilter的话,spring会利用WebApplicationContextUti
利用ContextLoaderListenter来加载dao、service级别的context,而对于struts的action,用ContextLoaderPlugIn加载。
出现了No WebApplicationContext found: no ContextLoaderListener
registered异常,此问题产生的原因是因他的资源文件没加载进来所以找不到文件引起,于是我在web.xml中加入了如下语句:
- <!-- Spring ApplicationContext配置文件的路径,可使用通配符,多个路径用,号分隔此参数用于后面的Spring-Context loader -->
-
-
<context-param> -
-
<param-name>contextConfigLocation</param-name> -
-
<param-value>classpath*:applicationContext.xml</param-value> -
-
</context-param>
结果不起作用;
改为<context-param>
也不起作用。
说法2:
配置监听,也是没有加载到这个类,原理都一样,可能不太清楚怎么配置,也不起作用
<listener>
</listener>
说法3:
看你报错应该是spring没正常工作,web.xml里要配的
<servlet>
<servlet-name>SpringContextServlet </servlet-name>
<servlet-class>
org.springframework.web.context.ContextLoaderServlet
</servlet-class>
<load-on-startup>1 </load-on-startup>
</servlet>
ContextLoaderServlet这个类不加载的话,肯定会报 No WebApplicationContext found: noContextLoaderListener registered
这个就能用了
- no ContextLoaderListener registered的解决方法
- No WebApplicationContext found: no ContextLoaderListener registered的解决方法
- No WebApplicationContext found: no ContextLoaderListener registered的解决方法
- No WebApplicationContext found: no ContextLoaderListener registered的解决方法
- No WebApplicationContext found: no ContextLoaderListener registered?
- No WebApplicationContext found: no ContextLoaderListener registered异常
- No WebApplicationContext found: no ContextLoaderListener registered?
- No WebApplicationContext found: no ContextLoaderListener registered?
- No WebApplicationContext found: no ContextLoaderListener registered
- No WebApplicationContext found: no ContextLoaderListener registered?
- No WebApplicationContext found: no ContextLoaderListener registered?
- No WebApplicationContext found: no ContextLoaderListener registered错误
- java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered?
- No WebApplicationContext found: no ContextLoaderListener registered 错误解决
- java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered
- 异常备忘:No WebApplicationContext found: no ContextLoaderListener registered
- No WebApplicationContext found: no ContextLoaderListener registered?报错解决
- Spring 过滤器DelegatingFilterProxy No WebApplicationContext found: no ContextLoaderListener registered?
- 【也许你不知道的Word超链接取消三个小技巧】
- 23种设计模式(4):建造者模式
- java记事本改良版
- 第三章 内置数据类型
- 第十六周项目一----重做哦涨了涨了O(∩_∩)O~
- no ContextLoaderListener registered的解决方法
- C# 程序打包 升级方案要点
- [bzoj1500][NOI2005]维修数列
- Qt中使用setStyleSheet对按钮进行外观设置
- 23种设计模式(5):原型模式
- 16周:阅读程序
- 求根
- c# winform 调用WebService实例
- 23种设计模式(6):模版方法模式