今天在使用三大框架开发个小项目时,遇到了下面的小问题,在此和大家分享一下,也大家分享一下解决问题的办法。
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/applicationContext.xml]
除了上面的错误消息外,myeclipse还报了下面的错误消息:
Caused by: java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/applicationContext.xml]at org.springframework.web.context.support.ServletContextResource.getInputStream(ServletContextResource.java:117)at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336)... 36 more
从上面的错误消息可以得到:造成上面的错误是因为在目录/WEB-INF/下没有找到applicationContext.xml配置文件,所以解决方法就是在web.xml中添加
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
便可以解决问题