问题描述
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListenerorg.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]Caused by: java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/applicationContext.xml]at org.springframework.web.context.support.ServletContextResource.getInputStream(ServletContextResource.java:99)at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:351)at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:126)at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:142)at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:123)at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:91)at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:94)at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:294)at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:156)at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184)at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
解决方案
放到下面这个目录试一下web-inf/classes/applicationContext.xml
解决方案二:
错误太明显了吧?
解决方案三:
放到WEB-INF文件夹下试试。
解决方案四:
java.io.FileNotFoundException 文件找不到。试试classpath:applicationContext.xml