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]相关推荐
- Error creating bean with name 'servletEndpointRegistrar' defined in class path resource
记一次配置内容丢失导致报错问题:Error creating bean with name 'servletEndpointRegistrar' defined in class path resou ...
- Error creating bean with name ‘servletEndpointRegistrar‘ defined in class path resource
记录一下 今天在写为服务项目碰到的错误,如下面所示,只知道创建Error creating bean with name 'servletEndpointRegistrar' defined in c ...
- 启动springboot报错Error creating bean with name 'dataSource' defined in class path resource
2019独角兽企业重金招聘Python工程师标准>>> 启动springboot报错Error creating bean with name 'dataSource' define ...
- 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 ...
- BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [
现场情景: 初次搭建springboot工程,原本要搭建一个springboot+mybatis的maven工程,听说springboot会把一切给配置好,天真的在执行完mybatis自动生成mapp ...
- Error creating bean with name ‘redisConnectionFactory‘ defined in class path resource
1.问题描述 在redis整合springcache的时候一直报错. 按照信息找的发生问题的部分: @Configuration @EnableCaching public class RedisCo ...
- Error creating bean with name ‘entityManagerFactory‘ defined in class path resource解决方案
Error creating bean with name 'entityManagerFactory' defined in class path resource解决方案 参考文章: (1)Err ...
- 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 ...
- 解决Error creating bean with name ‘redisConnectionFactory‘ defined in class path resource...问题
文章目录 1. 复现问题 2. 分析问题 3. 解决问题 1. 复现问题 今天在启动spring boot项目时,出现如下错误: org.springframework.beans.factory.B ...
最新文章
- ORACLE的直方图的一些试验
- GraphicsMagick扩展配置安装
- 页面与页面之间传递参数
- 【问链财经-区块链基础知识系列】 第三十八课 以太坊智能合约账户全解析
- python 开发板 播放音乐_MicroPython开发板:TPYBoard v102 播放音乐实例
- Tomcat and solr 环境配置
- 等价类划分法-案例剖析-设计测试用例
- php币对人民币汇率_php汇率(php等于多少人民币)
- STM32CubeMAX入门篇
- R语言中同比增长和环比增长
- RocketMQ集群(2主2从)搭建详细步骤
- 微信内域名如何防封,微信域名防封跳转
- 【 MES】 MES的另一视角
- LightCMS1.3.7-RCE漏洞
- Unity案例-实现心电图效果
- centos7.4下Jira6环境部署及破解操作记录(完整版)
- matlab命令(应该很全了,欢迎补充!)
- Oracle 手工锁表
- html显示json数据中某一条的数据,php - 给定一个具有json格式数据的API,我该如何在HTML表中显示数据? - 堆栈内存溢出...
- 【活动】当我谈“资源”时我谈些什么