记一次启动tomcat时,遇到的无法加载[spring/dubbo-service.xml][spring/spring-context.xml]问题。
今天在生产环境部署一个dubbo项目,遇到如下报错:
2022-03-23 17:12:24.553 ERROR TraceId[] From[] To[] org.springframework.web.context.ContextLoader - Context initialization failed
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from relative location [dubbo-service.xml]
Offending resource: class path resource [spring/spring-context.xml]; nested exception is org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from relative location [dubbo-consumer.xml]
Offending resource: class path resource [spring/dubbo-service.xml]; nested exception is org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 6 in XML document from class path resource [spring/dubbo-consumer.xml] is invalid; nested exception is org.xml.sax.SAXParseException; systemId: http://code.alibabatech.com/schema/dubbo/dubbo.xsd; lineNumber: 6; columnNumber: 68; TargetNamespace.1: Expecting namespace 'http://code.alibabatech.com/schema/dubbo', but the target namespace of the schema document is 'http://dubbo.apache.org/schema/dubbo'.
at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:70)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:76)
Expecting namespace ‘http://code.alibabatech.com/schema/dubbo’, but the target namespace of the schema document is ‘http://dubbo.apache.org/schema/dubbo’.
问题原因:
dubbo 版本冲突!!!
找到lib目录里的dubbo包,删掉低版本的即可,问题解决