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]相关推荐

  1. Error creating bean with name 'servletEndpointRegistrar' defined in class path resource

    记一次配置内容丢失导致报错问题:Error creating bean with name 'servletEndpointRegistrar' defined in class path resou ...

  2. Error creating bean with name ‘servletEndpointRegistrar‘ defined in class path resource

    记录一下 今天在写为服务项目碰到的错误,如下面所示,只知道创建Error creating bean with name 'servletEndpointRegistrar' defined in c ...

  3. 启动springboot报错Error creating bean with name 'dataSource' defined in class path resource

    2019独角兽企业重金招聘Python工程师标准>>> 启动springboot报错Error creating bean with name 'dataSource' define ...

  4. Meavn 搭建项目遇到Error creating bean with name 'sessionFactory' defined in class path resource...

    Error creating bean with name 'sessionFactory' defined in class path resource .nested exception is j ...

  5. BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [

    现场情景: 初次搭建springboot工程,原本要搭建一个springboot+mybatis的maven工程,听说springboot会把一切给配置好,天真的在执行完mybatis自动生成mapp ...

  6. Error creating bean with name ‘redisConnectionFactory‘ defined in class path resource

    1.问题描述 在redis整合springcache的时候一直报错. 按照信息找的发生问题的部分: @Configuration @EnableCaching public class RedisCo ...

  7. Error creating bean with name ‘entityManagerFactory‘ defined in class path resource解决方案

    Error creating bean with name 'entityManagerFactory' defined in class path resource解决方案 参考文章: (1)Err ...

  8. Error creating bean with name 'dataSource' defined in class path resource [spring/spring-dao.xml]:

    Error creating bean with name 'dataSource' defined in class path resource [spring/spring-dao.xml]: B ...

  9. 解决Error creating bean with name ‘redisConnectionFactory‘ defined in class path resource...问题

    文章目录 1. 复现问题 2. 分析问题 3. 解决问题 1. 复现问题 今天在启动spring boot项目时,出现如下错误: org.springframework.beans.factory.B ...

最新文章

  1. ORACLE的直方图的一些试验
  2. GraphicsMagick扩展配置安装
  3. 页面与页面之间传递参数
  4. 【问链财经-区块链基础知识系列】 第三十八课 以太坊智能合约账户全解析
  5. python 开发板 播放音乐_MicroPython开发板:TPYBoard v102 播放音乐实例
  6. Tomcat and solr 环境配置
  7. 等价类划分法-案例剖析-设计测试用例
  8. php币对人民币汇率_php汇率(php等于多少人民币)
  9. STM32CubeMAX入门篇
  10. R语言中同比增长和环比增长
  11. RocketMQ集群(2主2从)搭建详细步骤
  12. 微信内域名如何防封,微信域名防封跳转
  13. 【 MES】 MES的另一视角
  14. LightCMS1.3.7-RCE漏洞
  15. Unity案例-实现心电图效果
  16. centos7.4下Jira6环境部署及破解操作记录(完整版)
  17. matlab命令(应该很全了,欢迎补充!)
  18. Oracle 手工锁表
  19. html显示json数据中某一条的数据,php - 给定一个具有json格式数据的API,我该如何在HTML表中显示数据? - 堆栈内存溢出...
  20. 【活动】当我谈“资源”时我谈些什么

热门文章

  1. Windows系统自带邮件软件中绑定QQ邮箱具体操作
  2. Java课程设计项目 客户信息管理软件 客户信息管理系统的实现
  3. HDMI 网线延长器
  4. LoRa节点开发:4、代码详解 LoRaWAN节点入网
  5. 直播 相关技术文章 相关调研文章
  6. java8 集合的交集、并集、差集
  7. FreeRTOS使用软件定时器
  8. 实现html下载为pdf时分页不切断table表格或者echarts图片
  9. 新款武侠游戏 请名人献声
  10. 第十周 吉林市一日游