zoukankan      html  css  js  c++  java
  • CXF2.7.0配置REST和spring时报错:Error creating bean with name '***': Invocation of init method failed; nested exception is ***.ServiceConstructionException

    今天配置CXF2.7.0的REST和spring时一直再报:

    Error creating bean with name '***': Invocation of init method failed; nested exception is org.apache.cxf.service.factory.ServiceConstructionException的错误,查看了自己的application-server.xml里面的bean配置没问题,找了一下午,最后发现是jar包冲突。

    网页地址是:http://mail-archives.apache.org/mod_mbox/cxf-dev/201210.mbox/%3CE1C17F1F-FCF2-400F-87B3-07C17044089A@apache.org%3E

    指定的网址是:http://cxf.547215.n5.nabble.com/CXF-2-7-0-and-Rest-jaxrs-service-td5716862.html#a5716890

    贴出来是:

    错误:

    SEVERE: Context initialization failed
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bookservice': Invocation of init method failed; nested exception is org.apache.cxf.service.factory.ServiceConstructionException
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1422)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:518)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)
            at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
            at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
            at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
            at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)
            at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
            at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
            at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
            at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:282)
            at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:204)
            at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
            at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4791)
            at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285)
            at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
            at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
            at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
            at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
            at java.util.concurrent.FutureTask.run(Unknown Source)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
            at java.lang.Thread.run(Unknown Source)
    Caused by: org.apache.cxf.service.factory.ServiceConstructionException
            at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:201)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
            at java.lang.reflect.Method.invoke(Unknown Source)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1546)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1487)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1419)
            ... 22 more
    Caused by: java.lang.NullPointerException
            at org.apache.cxf.ws.discovery.listeners.WSDiscoveryServerListener.startServer(WSDiscoveryServerListener.java:64)
            at org.apache.cxf.bus.managers.ServerLifeCycleManagerImpl.startServer(ServerLifeCycleManagerImpl.java:61)
            at org.apache.cxf.endpoint.ServerImpl.start(ServerImpl.java:146)
            at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:192)
            ... 29 more

    解释是:

    CXF bug.  You can remove the cxf-services-ws-discovery-service-2.7.0.jar from the lib dir and it should "fix" this. 

    意思就是删除cxf-services-ws-discovery-service-2.7.0.jar这个jar包。

    问题解决....

  • 相关阅读:
    Bluetooth ATT 介绍
    用SQL语句去掉重复的记录
    xib模块化设计
    iOS 指纹识别常见问题汇总
    蓝牙信息传播原理
    UIAlertView 或 UIAlertController message 文字对齐设置
    iOS 跳转到系统设置的问题
    nordic 52832 DFU后出现无法重连的问题
    UIView类绘图出现错误提示
    nordic DFU固件升级
  • 原文地址:https://www.cnblogs.com/tv151579/p/2813928.html
Copyright © 2011-2022 走看看