当前位置:   article > 正文

springboot整合webservice,启动错误处理_.demo.webservicecontroller.printerror

.demo.webservicecontroller.printerror

错误一、DispatcherServlet Registration found non dispatcher servlet dispatcherServlet

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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

出现原因及解决办法

代码中初始化bean时有重名的dispatcherServlet,例如:
在这里插入图片描述

错误二、The following method did not exist: org.apache.cxf.common.jaxb.JAXBUtils.createMininumEscapeHandler(Ljava/lang/Class;)Ljava/lang/Object;

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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33

出现原因及解决办法

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>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/187005
推荐阅读
相关标签
  

闽ICP备14008679号