Could not open ServletContext resource [/WEB-INF/applicationContext.xml]

来源:互联网 发布:java建造者设计模式 编辑:程序博客网 时间:2024/05/10 06:21

错误如下: org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from resource [/WEB-INF/applicationContext.xml] of ServletContext; nested exception is java.io.FileNotFoundException: Could not open resource [/WEB-INF/applicationContext.xml] of ServletContext java.io.FileNotFoundException: Could not open resource [/WEB-INF/applicationContext.xml] of ServletContext

 

 

 原因: 加载spring的配置文件时在默认位置/WEB-INF/下找不到applicationContext.xml文件,看了下,myeclipse自动生成的applicationContext.xml放在/WEB-INF/classes下,难怪找不到,终于发现问题了,下面在web.xml中做如下配置即可解决: contextConfigLocation /WEB-INF/classes/applicationContext.xml

原创粉丝点击