Configuration problem: Failed to import bean definitions from relative location

问题现象:

最近开始做新需求,然后在Tomcat上部署项目时,出现了如下报错:

[12-05 09:54:27,161 ERROR] ContextLoader.java:351 - Context initialization failed
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from relative location [spring-controller-slave.xml]
Offending resource: class path resource [spring.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from URL [file:/E:/java/tomcat/apache-tomcat-8.5.31/webapps/ROOT/WEB-INF/classes/spring-controller-slave.xml]; nested exception is java.io.FileNotFoundException: E:\java\tomcat\apache-tomcat-8.5.31\webapps\ROOT\WEB-INF\classes\spring-controller-slave.xml

具体就是IO解析错误,无法解析XML文件,

IOException parsing XML document from class path resource [file:/E:/java/tomcat/apache-tomcat-8.5.31/webapps/ROOT/WEB-INF/classes/spring-controller-slave.xml]

问题分析:

这个问题是概率性出现的,文件是存在的,但是还是报错了,怀疑是Tomcat缓存问题。

于是清除了Tomcat缓存,clean了项目,甚至update了maven项目,然后再启动tomcat,有概率性成功;如果还是失败,就在Tomcat发布项目的地方,将发布项目的文件夹删除,然后重新clean,一般来说,就会成功了。

这个问题虽然这样可以解决,但具体的原理还是不清楚,待以后慢慢研究,先记下再说。

最终发现是编译后的target文件夹里面里面缺少xml文件导致的,

最简单的就是手动copy缺少的xml文件进去重启tomcat解决

原文地址:https://www.cnblogs.com/syp172654682/p/10069319.html

时间: 2024-08-01 17:52:51

Configuration problem: Failed to import bean definitions from relative location的相关文章

org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unexpected failure during bean definition parsing Offending resource: class path resource [applicationC

这个错误是 org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unexpected failure during bean definition parsing Offending resource: class path resource [applicationContext.xml] Bean 'stu'; nested exception is

Spring源码解析 – @Configuration配置类及注解Bean的解析

在分析Spring 容器创建过程时,我们知道容器默认会加载一些后置处理器PostPRocessor,以AnnotationConfigApplicationContext为例,在构造函数中初始化reader时,加载默认后置处理器.其中 ConfigurationClassPostProcessor这个后置处理器专门处理带有@Configuration注解的类,ConfigurationClassPostProcessor后置处理实现了BeanDefinitionRegistryPostProce

Oracle Net Configuration Assistant failed异常的解决方案

来自:http://blog.itpub.net/25851087/viewspace-1419440/ 分类: Oracle [环境参数]     Host OS::Win7 32bit     Client OS::Oracle Enterprise Linux 5     虚拟机:VMware 10.0..1     Oracle版本:Oracle 11g R2   [障害场景一再现] 1.障碍描述: 在CentOS或者Oracle Enterprise Linux环境下,安装Oracle

springsecurity启动出现org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: You must use a 3.0 schema with Spring Security 3.0.

在换了spring-security的jar包以后启动出现org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: You must use a 3.0 schema with Spring Security 3.0.Please update your schema declarations to the 3.0.3 schema (spring-securi

Ant Problem: failed to create task or type foreach 问题

用eclipse导出android时总是会出现有类没有导出的现象,感觉非常麻烦,就用ant些了脚本.在eclipse中运行脚本没问题.可是在命令行下运行会出现 Problem: failed to create task or type foreach问题.出问题的脚本是 <taskdef resource="net/sf/antcontrib/antcontrib.properties" classpath="${path.build}/ant-contrib.jar

Oracle12c client安裝報錯[INS-20802] Oracle Net Configuration Assistant failed完美解決

Doc ID 2082662.1 1.錯誤碼 Installation Of Oracle Client 12.1.0.2.0 (32-bit) Fails With An Error Message "[INS-20802] Oracle Net Configuration Assistant failed 2.問題描述 在window 7安裝Oracle Client12C的時候遇到INS-20802 Oracle Net Configuration Assistant失敗的問題,百度了很多

Spring 中出现Element : property Bean definitions can have zero or more properties. Property elements correspond to JavaBean setter methods exposed by the bean classes. Spring supports primitives, refer

在这个ApplicationContext.xml文件中出现 如下报错 Element : property Bean definitions can have zero or more properties. Property elements correspond to JavaBean setter methods exposed by the bean classes. Spring supports primitives, references to other beans in th

启动项目的时候报错: Loading XML bean definitions from class path resource [applicationContext.xml]

记录一下: org.springframework.context.support.AbstractApplicationContext prepareRefresh Refreshing org[email protected]7cef4e59: startup date [Fri Sep 30 09:33:28 CST 2016]; root of context hierarchy org.springframework.beans.factory.xml.XmlBeanDefinitio

Failed to import pydot

在使用keras进行模型绘制的时候,出现了一个错误 Failed to import pydot. You must install pydot and graphviz for `pydotprint` to work. 下面是解决方案,使用命令sudo apt-get install graphviz,将graphviz安装在系统环境下,不要安装在virtualenv的环境下. 使用命令pip install pydot-ng,这个可以安装任何你所指定的python环境下. 附上参考链接:h