gajicat 2017-10-16 02:49 采纳率: 0%
浏览 2364
已结题

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条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 关于使用MATLAB中copularnd函数的问题
    • ¥20 在虚拟机的pycharm上
    • ¥15 jupyterthemes 设置完毕后没有效果
    • ¥15 matlab图像高斯低通滤波
    • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗
    • ¥15 钢筋实图交点识别,机器视觉代码
    • ¥15 如何在Linux系统中,但是在window系统上idea里面可以正常运行?(相关搜索:jar包)
    • ¥50 400g qsfp 光模块iphy方案
    • ¥15 两块ADC0804用proteus仿真时,出现异常
    • ¥15 关于风控系统,如何去选择