Maven里Xerces依赖冲突导致Spring加载xml出错

今天维护一个公司的老项目,在启动的时候报了一个错误。如下:

错误:

ERROR [org.springframework.web.context.ContextLoader] - Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: Parser configuration exception parsing XML from ServletContext resource [/WEB-INF/conf/applicationContext-dataSource.xml]; nested exception is javax.xml.parsers.ParserConfigurationException: Unable to validate using XSD: Your JAXP provider [gnu.xml.dom.JAXPFactory@5e7663] does not support XML Schema. Are you running on Java 1.4 or below with Apache Crimson? Upgrade to Apache Xerces (or Java 1.5) for full XSD support.
Caused by: 
javax.xml.parsers.ParserConfigurationException: Unable to validate using XSD: Your JAXP provider [gnu.xml.dom.JAXPFactory@5e7663] does not support XML Schema. Are you running on Java 1.4 or below with Apache Crimson? Upgrade to Apache Xerces (or Java 1.5) for full XSD support.

解决:

项目中移除xerces.XXX.jar (不同版本的)

只用 xercesImpl.XXX.jar 

参考:https://blog.csdn.net/peachpi/article/details/6868541

发布了18 篇原创文章 · 获赞 11 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/qaz5209103/article/details/89491703