[Spring]:?ERROR 2009-04-10 21:57:00,093 ContextLoader:initWebApplicationContext - Context initialization failed
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]
?at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:349)
?at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
?at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
?at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
?at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
?at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124)
?at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:92)
?at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)
?at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:422)
?at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
?at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
?at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
?at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
?at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
?at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
?at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
?at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
?at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
?at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
?at org.apache.catalina.core.StandardService.start(StandardService.java:516)
?at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
?at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
?at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
?at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
?at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
?at java.lang.reflect.Method.invoke(Unknown Source)
?at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
?at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
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)
?... 27 more
ERROR 2009-04-10 21:57:00,093 ContextLoader:initWebApplicationContext - Context initialization failed
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]
?at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:349)
?at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
?at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
?at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
?at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
?at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124)
?at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:92)
?at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)
?at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:422)
?at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
?at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
?at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
?at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
?at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
?at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
?at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
?at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
?at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
?at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
?at org.apache.catalina.core.StandardService.start(StandardService.java:516)
?at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
?at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
?at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
?at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
?at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
?at java.lang.reflect.Method.invoke(Unknown Source)
?at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
?at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
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)
?... 27 more
2009-4-10 21:57:00 org.apache.catalina.core.StandardContext listenerStart
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
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]
?at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:349)
?at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
?at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
?at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
?at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
?at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124)
?at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:92)
?at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)
?at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:422)
?at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
?at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
?at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
?at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
?at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
?at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
?at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
?at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
?at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
?at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
?at org.apache.catalina.core.StandardService.start(StandardService.java:516)
?at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
?at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
?at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
?at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
?at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
?at java.lang.reflect.Method.invoke(Unknown Source)
?at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
?at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
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)
?... 27 more
2009-4-10 21:57:00 org.apache.catalina.core.StandardContext start
严重: Error listenerStart
2009-4-10 21:57:00 org.apache.catalina.core.StandardContext start
严重: Context [/auction] startup failed due to previous errors
2009-4-10 21:57:00 org.apache.catalina.core.ApplicationContext?log
解决方法:
在web.xml中加入这些配置
<context-param>
????<param-name>contextConfigLocation?</param-name>
????<param-value>/WEB-INF/classes/applicationContext.xml </param-value>
</context-param>
问题主要由于加载spring的默认配置文件位置一般是在/WEB-INF/下找applicationContext.xml文件。而Myeclipse文件自动生成的applicationContext文件是放在/WEB-INF/classes/applicationContext.xml。所以在默认加载中是找不到applicationContext.xml文件的,必须加入上面配置。
详细解决方案
[/WEB-INF/applicationContext.xml]解决办法
热度:2667 发布时间:2012-10-11 10:16:10.0
Could?not?open?ServletContext?resource?[/WEB-INF/applicationContext.xml]解决方法
问题表现 相关解决方案
- jquery,二维数组取值。解决办法
- 求架构方案:一个日均访问量50万的物流筛单系统的技术架构方案?解决办法
- 关于 if(rs.getString("").trim().equals(""))解决办法
- 诡异:代码执行到哪去了?解决办法
- 关于 Spring 声明式事务管理!解决办法
- applicationContext.xml怎么和JAVA代码关联
- 求《Java Web 程序设计与项目实践》解决办法
- 加载Hibernate的报错了,求解。解决办法
- B/S方面,java比PHP更好吗?解决办法
- 算法求解String str = "A,B,C,A,B,A"解决办法
- 这段代码还能不能优化?解决办法
- JAVA读取一个文件,非得搞那么麻烦么?解决办法
- 求帮忙。解决办法
- POI导入excel数据(数据有父子关系)解决办法
- IE不支持JQuery吗?解决办法
- 求WebService的解决方案!解决办法
- 关于ibatis的<isNotEmpty>解决办法
- hibernate获取SessionFactory失败 咋办?解决办法
- 关于<s:iterator>遍历数据。解决办法
- ASP技术升级选择.(.net或Java)解决办法
- jsp页面提交到action,中文乱码(服务器Tomcat5.0)解决办法
- 求按钮上传~解决办法
- 在项目中META INF下创建context.xml获得mysql数据库连接池(急)解决办法
- SSH插入数据,报空指针?解决办法
- JBPM 报错,需回答,在线急等!解决办法
- 吐了,java Timer 停止不了。解决办法
- struts2 带查询条件分页怎样把值带入下一页?解决办法
- jxl导出报表时,怎样合并单元格?解决办法
- axjax与ASP的数据交换的写法?解决办法
- 怎样编写jsp登陆次数超过3次就锁定用户,再过24小时就取消锁定?解决办法