日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Error creating bean with name ‘endpoint‘ defined in class path resource [.../CxfConfig.class]

發布時間:2023/12/20 编程问答 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Error creating bean with name ‘endpoint‘ defined in class path resource [.../CxfConfig.class] 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Spring boot項目整合webservice后,引入阿里云短信包,項目啟動報錯。


問題描述:

最近一個老項目發送短信的接口需要由網易換成阿里云的,本來其它項目引入都沒什么問題,但這個項目之前使用cxf整合過webservice,導入阿里的jar包后,項目啟動報錯

Error creating bean with name ‘endpoint’ defined in class path resource [ct/edu/lms/web/server/config/CxfConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.xml.ws.Endpoint]: Factory method ‘endpoint’ threw exception; nested exception is javax.xml.ws.WebServiceException:

完整截圖:

引入的包:

//cxf<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web-services</artifactId><version>2.1.4.RELEASE</version></dependency><dependency><groupId>org.apache.cxf</groupId><artifactId>cxf-rt-frontend-jaxws</artifactId><version>3.1.6</version></dependency><dependency><groupId>org.apache.cxf</groupId><artifactId>cxf-rt-transports-http</artifactId><version>3.1.6</version></dependency>//阿里云短信<dependency><groupId>com.aliyun</groupId><artifactId>aliyun-java-sdk-core</artifactId><version>4.1.0</version></dependency>

原因分析、解決:

報錯大概是因為cxf包和阿里云的包中某個xml解析包沖突了,其中有個com.sun.xml.bind是阿里云中的,于是嘗試使用exclusions去掉不想要的包,項目啟動正常。代碼如下:

<!-- 阿里云短信 --><dependency><groupId>com.aliyun</groupId><artifactId>aliyun-java-sdk-core</artifactId><version>4.1.0</version><exclusions><exclusion><groupId>com.sun.xml.bind</groupId><artifactId>jaxb-core</artifactId></exclusion><exclusion><groupId>com.sun.xml.bind</groupId><artifactId>jaxb-impl</artifactId></exclusion> </exclusions></dependency>

后續

本以為項目啟動不報錯就可以了,但短信發送不了!只能繼續找原因,到官網查看,發現官網的jar包已經升級到了4.5.3,嘗試引入,所有的問題都解決了。

<!-- 阿里云短信 --><dependency><groupId>com.aliyun</groupId><artifactId>aliyun-java-sdk-core</artifactId><version>4.5.3</version></dependency>

進入包中查看發現新版已經去掉com.sun.xml.bind這兩個包了,應該也是修復了相應的bug。


總結

糾結了大半天的問題,升級一下就解決了,還是需要仔細分析問題,從源頭找解決辦法,特此記錄一下。

總結

以上是生活随笔為你收集整理的Error creating bean with name ‘endpoint‘ defined in class path resource [.../CxfConfig.class]的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。