Spring boot 採用Cxf 整合WebService 執行報錯“Error creating bean with name 'endpoint' defined ”
阿新 • • 發佈:2018-12-14
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>