No WebApplicationContext found: no ContextLoaderListener registered 错误解决
来源:互联网 发布:linux pid查询 编辑:程序博客网 时间:2024/05/17 04:44
错误信息如下:
java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered?
at org.springframework.web.context.support.WebApplicationContextUtils.getRequiredWebApplicationContext(WebApplicationContextUtils.java:70)
at org.springframework.web.struts.DelegatingActionUtils.findRequiredWebApplicationContext(DelegatingActionUtils.java:148)
at org.springframework.web.struts.ActionSupport.initWebApplicationContext(ActionSupport.java:98)
at org.springframework.web.struts.ActionSupport.setServlet(ActionSupport.java:78)
at org.apache.struts.action.RequestProcessor.processActionCreate(RequestProcessor.java:299)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:221)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
at java.lang.Thread.run(Thread.java:619)
Spring 中抛出错误地方的源码为:
public static WebApplicationContext getRequiredWebApplicationContext(ServletContext sc)
throws IllegalStateException {
WebApplicationContext wac = getWebApplicationContext(sc);
if (wac == null) {
throw new IllegalStateException("No WebApplicationContext found: no ContextLoaderListener registered?");
}
return wac;
}
由此可见,系统抛出上述错误的原因是wac == null,即加载 Spring 失败。
解决办法:在web.xml添加如下内容。
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:applicationContext.xml</param-value>
</context-param>
<servlet>
<servlet-name>SpringContextServlet </servlet-name>
<servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
<load-on-startup>1 </load-on-startup>
</servlet>
- 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?
- 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
- Spring 过滤器DelegatingFilterProxy No WebApplicationContext found: no ContextLoaderListener registered?
- android适配器模式设计与实现
- Jquery经验教训日志
- IPHONE - GSRegisterPurpleNamedPort SIGABRT in UIApplicationMain Before App Delegate Gets to Run Any Code
- asp.net mvc 如何在执行完某任务后返回原来页面
- 字符编码由来及详细(转帖)
- No WebApplicationContext found: no ContextLoaderListener registered 错误解决
- http协议的工作原理【zz】
- android 2.2 获取联系人,电话,并拨号
- Android 中Intent调用系统程序总结
- Android LocationManager 使用
- android 怎么调用联系人列表,并将选择的联系人号码显示在文本框里
- Javascript数据缓存实现 jCaches
- 学习vi编辑器 —— ex 编辑器
- oversample & upsample