gajicat 2017-10-15 18:49 采纳率: 0%
浏览 2365
已结题

Spring Boot + Spring Cloud + cxf + maven 启动报错

Springboot+SpringCloud微服务框架上用cxf搭建webservice服务端,启动时报NoSuchMethodError错误。

 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cxf' defined in class path resource [cn/ffcs/geye/crm/webService/server/ServiceConfig.class]: Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: org.apache.cxf.bus.spring.SpringBeanLocator.<init>(Lorg/springframework/context/ApplicationContext;Lorg/apache/cxf/Bus;)V
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:564)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
    at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:134)
    at cn.ffcs.StartApplication.main(StartApplication.java:26)
Caused by: java.lang.NoSuchMethodError: org.apache.cxf.bus.spring.SpringBeanLocator.<init>(Lorg/springframework/context/ApplicationContext;Lorg/apache/cxf/Bus;)V
    at org.apache.cxf.bus.spring.SpringBus.setApplicationContext(SpringBus.java:81)
    at org.springframework.context.support.ApplicationContextAwareProcessor.invokeAwareInterfaces(ApplicationContextAwareProcessor.java:121)
    at org.springframework.context.support.ApplicationContextAwareProcessor.postProcessBeforeInitialization(ApplicationContextAwareProcessor.java:97)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:409)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1620)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
    ... 14 common frames omitted

代码参考 http://blog.csdn.net/hj7jay/article/details/51130386

添加maven依赖cxf版本是3.1.6。webservice实现类中用@Resource注解注入MyBatis数据库模块(数据库调用在另一个micro server)。

查看错误栈发现,问题在于启动过程中初始化cxf对象,SpringBus类setApplicationContext方法调用SpringBeanLocator类构造方法SpringBeanLocator(ApplicationContext, Bus)。该版本的cxf依赖jar包cxf-rt-core-2.3.1.jar中只有单个参数的构造方法SpringBeanLocator(ApplicationContext)。

换较高和较低的cxf版本,报同样的错误,下载的jar包cxf-rt-core依然是2.3.1版本的。

之前单单搭webservice框架,没有自动注入和处理逻辑时曾经启动成功过并可以访问wsdl,现在怎么弄都启动不成功。大神帮忙。

展开全部

  • 写回答

0条回答 默认 最新

    编辑
    预览

    报告相同问题?

    悬赏问题

    • ¥15 宝塔面板一键迁移使用不了
    • ¥15 求一个按键录像存储到内存卡的ESP32CAM代码
    • ¥15 如何单独修改下列canvas推箱子代码target参数?,插入图片代替其形状,就是哪个绿色的圆圈每关用插入的图片替代
    • ¥20 四叉树的创建和输出问题
    • ¥15 javaweb连接数据库,jsp文件加载不出来
    • ¥15 matlab关于高斯赛德尔迭代的应用编撰。(相关搜索:matlab代码|迭代法)
    • ¥15 损失匹配问题,求解答
    • ¥15 3500常用汉字书法体检测数据集下载
    • ¥15 odoo17在制造模块或采购模块良品与次品如何分流和在质检模块下如何开发
    • ¥15 Qt音乐播放器的音乐文件相对路径怎么写