赞
踩
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
Disconnected from the target VM, address: '127.0.0.1:58994', transport: 'socket'
2020-04-08 18:37:24.046 ERROR 29272 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Parameter 1 of constructor in org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration required a bean of type 'org.springframework.boot.autoconfigure.web.servlet.DispatcherServletPath' that could not be found.
The following candidates were found but could not be injected:
- Bean method 'dispatcherServletRegistration' in 'DispatcherServletAutoConfiguration.DispatcherServletRegistrationConfiguration' not loaded because DispatcherServlet Registration found non dispatcher servlet dispatcherServlet
代码中初始化bean时有重名的dispatcherServlet,例如:
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2020-04-08 18:44:16.562 ERROR 27504 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPLICATION FAILED TO START *************************** Description: An attempt was made to call a method that does not exist. The attempt was made from the following location: org.apache.cxf.jaxb.JAXBDataBinding.setContext(JAXBDataBinding.java:257) The following method did not exist: org.apache.cxf.common.jaxb.JAXBUtils.createMininumEscapeHandler(Ljava/lang/Class;)Ljava/lang/Object; The method's class, org.apache.cxf.common.jaxb.JAXBUtils, is available from the following locations: jar:file:/D:/maven-repository/org/apache/cxf/cxf-core/3.1.15/cxf-core-3.1.15.jar!/org/apache/cxf/common/jaxb/JAXBUtils.class It was loaded from the following location: file:/D:/maven-repository/org/apache/cxf/cxf-core/3.1.15/cxf-core-3.1.15.jar Action: Correct the classpath of your application so that it contains a single, compatible version of org.apache.cxf.common.jaxb.JAXBUtils Disconnected from the target VM, address: '127.0.0.1:59435', transport: 'socket' Process finished with exit code 1
maven中引入的cxf-spring-boot-starter-jaxws版本中的cxf-core版本为3.1.5过低所致。网上说可以通过修改cxf-spring-boot-starter-jaxws的版本解决,但是springboot2.1.9试了遍后发现仍然报一样的错误,于是索性直接exclude掉cxf-spring-boot-starter-jaxws里的cxf-core,重新引入新版。
果然解决,pom.xml大致如下。
<properties> <cxf-spring-boot-starter-jaxws.version>3.2.5</cxf-spring-boot-starter-jaxws.version> <cxf-spring-boot-starter-jaxrs.version>3.2.5</cxf-spring-boot-starter-jaxrs.version> </properties> <dependencies> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-spring-boot-starter-jaxws</artifactId> <version>${cxf-spring-boot-starter-jaxws.version}</version> <exclusions> <exclusion> <artifactId>cxf-core</artifactId> <groupId>org.apache.cxf</groupId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-core</artifactId> <version>3.2.6</version> </dependency> </dependencies>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。