`
tomgooityeeee
  • 浏览: 73910 次
文章分类
社区版块
存档分类
最新评论
阅读更多

    <span style="font-family: SimSun; font-size: 18px;">报错信息:</span>

<span style="font-family: Times New Roman; font-size: 16px;">java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered?<br>
org.springframework.web.context.support.WebApplicationContextUtils.getRequiredWebApplicationContext(WebApplicationContextUtils.java:70)<br>
org.springframework.web.struts.DelegatingActionUtils.findRequiredWebApplicationContext(DelegatingActionUtils.java:148)<br>
org.springframework.web.struts.DelegatingRequestProcessor.initWebApplicationContext(DelegatingRequestProcessor.java:134)<br>
org.springframework.web.struts.DelegatingRequestProcessor.init(DelegatingRequestProcessor.java:114)<br>
org.apache.struts.action.ActionServlet.getRequestProcessor(ActionServlet.java:602)<br>
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1192)<br>
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)<br>
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)<br>
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)</span>

<span style="font-family: Times New Roman; font-size: 18px;">解决办法:</span>

<span style="font-family: Times New Roman; font-size: 16px;">1、:发现原来它的配置文件不是放在WEB-INF下,而是放在src目录下,解决的方法:</span>

<span style="font-family: Times New Roman; font-size: 16px;"> 1)将其spring的配置文件applicationContext转移阵地,转到WEB-INF下;</span>

<span style="font-family: Times New Roman; font-size: 16px;"> 2)在web.xml下加入如下语句:
<br>
<!-- Spring ApplicationContext配置文件的路径,可使用通配符,多个路径用,号分隔此参数用于后面的Spring-Context loader -->
</span>

<span style="font-family: Times New Roman; font-size: 16px;"> <context-param>
</span>

<span style="font-family: Times New Roman; font-size: 16px;"> <param-name>contextConfigLocation</param-name>
</span>

<span style="font-family: Times New Roman; font-size: 16px;"><param-value>/WEB-INF/applicationContext*.xml,classpath*:applicationContext*.xml</param-value>
</span>

<span style="font-family: Times New Roman; font-size: 16px;"> </context-param>
</span>

<span style="font-family: Times New Roman; font-size: 16px;">2、再在web.xml里面加上这些 <br>
<listener> <br>
<listener-class> <br>
org.springframework.web.context.ContextLoaderListener <br>
</listener-class> <br>
</listener> </span>

 
0
3
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics