将旧的Spring MVC 2项目升级到Spring Boot 2,会发生这样的错误:
2018-11-07 15:26:38.371错误4893 --- [main] o.s.boot.SpringApplication:应用程序运行失败
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: URL中XML文档的第8行 [jar:file:/Users/guojiahao/.m2/repository/javax/validation/validation-api/2.0.1.Final/validation-api-2.0.1.Final.jar!/xml-header-style.xml]是无效的;嵌套的异常是org.xml.sax.SAXParseException; lineNumber:8; columnNumber:20; cvc-elt.1:找不到 元素“ additionalHeaders”的声明。在 org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:404) 〜[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]在 org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336) 〜[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]在 org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304) 〜[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]在 org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188) 〜[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]在 org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:224) 〜[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]在 org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:195) 〜[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]在 org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.lambda $ loadBeanDefinitionsFromImportedResources $ 0(ConfigurationClassBeanDefinitionReader.java:358) 〜[spring-context-5.1.2.RELEASE.jar:5.1.2.RELEASE]在 java.util.LinkedHashMap.forEach(LinkedHashMap.java:684) 〜[na:1.8.0_172]在 org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsFromImportedResources(ConfigurationClassBeanDefinitionReader.java:325) 〜[spring-context-5.1.2.RELEASE.jar:5.1.2.RELEASE]在 org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:144) 〜[spring-context-5.1.2.RELEASE.jar:5.1.2.RELEASE]在 org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:117) 〜[spring-context-5.1.2.RELEASE.jar:5.1.2.RELEASE]在 org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:327) 〜[spring-context-5.1.2.RELEASE.jar:5.1.2.RELEASE]在 org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:232) 〜[spring-context-5.1.2.RELEASE.jar:5.1.2.RELEASE]在 org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:275) 〜[spring-context-5.1.2.RELEASE.jar:5.1.2.RELEASE]在 org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:95) 〜[spring-context-5.1.2.RELEASE.jar:5.1.2.RELEASE]在 org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:691) 〜[spring-context-5.1.2.RELEASE.jar:5.1.2.RELEASE]在 org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:528) 〜[spring-context-5.1.2.RELEASE.jar:5.1.2.RELEASE]在 org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) 〜[spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE]位于 org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) [spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE]位于 org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE]位于 org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE]位于 org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) [spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE]位于 org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE]位于 com.example.ite.Application.main(Application.java:9)[classes /:na] 引起原因:org.xml.sax.SAXParseException:cvc-elt.1:找不到 元素“ additionalHeaders”的声明。在 com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203) 〜[na:1.8.0_172]在 com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134) 〜[na:1.8.0_172]在 com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:396) 〜[na:1.8.0_172]在 com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327) 〜[na:1.8.0_172]在 com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:284) 〜[na:1.8.0_172]在 com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1901) 〜[na:1.8.0_172]在 com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:741) 〜[na:1.8.0_172]在 com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:374) 〜[na:1.8.0_172]在 com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl $ NSContentDriver.scanRootElementHook(XMLNSDocumentScannerImpl.java:613) 〜[na:1.8.0_172]在 com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl $ FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3132) 〜[na:1.8.0_172]在 com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl $ PrologDriver.next(XMLDocumentScannerImpl.java:852) 〜[na:1.8.0_172]在 com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602) 〜[na:1.8.0_172]在 com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112) 〜[na:1.8.0_172]在 com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505) 〜[na:1.8.0_172]在 com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:842) 〜[na:1.8.0_172]在 com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:771) 〜[na:1.8.0_172]在 com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141) 〜[na:1.8.0_172]在 com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:243) 〜[na:1.8.0_172]在 com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339) 〜[na:1.8.0_172]在 org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:77) 〜[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]在 org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadDocument(XmlBeanDefinitionReader.java:434) 〜[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]在 org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:392) 〜[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE] ... 23个常见框架 省略
以退出代码1完成的过程
Validation-api是spring-starter-web的依赖项之一:
我不知道为什么会出现此问题。您能否提供一些提示,或者有什么方法可以调试以找出问题的解决方案?