1. 程式人生 > >Spring boot 採用Cxf 整合WebService 執行報錯“Error creating bean with name 'endpoint' defined ”

Spring boot 採用Cxf 整合WebService 執行報錯“Error creating bean with name 'endpoint' defined ”

Spring boot 採用Cxf 整合WebService 執行報錯“Error creating bean with name ‘endpoint’ defined ”

由於新專案的需要,專案框架採用Spring boot 1.5.13.RELEASE、jdk 1.8、hive 2.0.0 、cxf 3.1.12等

執行錯誤

spring boot 整合 WebService 在本地可以正常執行,但打jar包後 執行報錯出現“Error creating bean with name ‘endpoint’ defined in class path resource” 在這裡插入圖片描述

部分pom引用,程式碼如下:

在這裡插入圖片描述

<dependency>
   	<groupId>org.apache.cxf</groupId>
		<artifactId>cxf-spring-boot-starter-jaxws</artifactId>
 		<version>3.1.12</version> 
</dependency>

在這裡插入圖片描述

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.13.RELEASE</version>
    </parent>

在這裡插入圖片描述

 <dependency>
            <groupId>org.apache.hive</groupId>
            <artifactId>hive-jdbc</artifactId>
            <version>2.0.0</version>
</dependency>

部分程式碼

WebService介面釋出類 在這裡插入圖片描述 service類 在這裡插入圖片描述

serviceImpl 實現類 在這裡插入圖片描述

解決方法

1.去除org.apache.hive hive-jdbc 裡面的asm 在這裡插入圖片描述 或者採取第二種方法 2.去除cxf-spring-boot-starter-jaxws裡面的asm

	<dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-spring-boot-starter-jaxws</artifactId>
            <version>3.1.12</version>
            <exclusions>
                <exclusion>
                    <groupId>asm</groupId>
                    <artifactId>asm</artifactId>
                </exclusion>
            </exclusions>
        </dependency>