日期:2014-05-19  浏览次数:20714 次

sh整合,急急急急急
异常IOException parsing XML document from class path resource [WEB-INFO/applicationContext.xml]; nested exception is java.io.FileNotFoundException: class path resource [WEB-INFO/applicationContext.xml] cannot be opened because it does not exist

为什么找不到applicationContext.xml文件。。。急急急急

------解决方案--------------------
web.xml 中配置下 classpath:applicationContext.xml
------解决方案--------------------
这是因为没有在类路径中找到相应的xml文件,首先,你可以讲spring相关的xml文件放置在src下或者某个包下面,
再在web.xml文件中加入以下参数:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:applicationContext.xml,</param-value>
</context-param>
当然,监听一定得加:
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
------解决方案--------------------
楼上两位已经说的很清楚了,就是spring的配置文件要先在web.xml中先配置