• BeanCreationNotAllowedException: Error creating bean with name 'cxf' 的原因和解决方案


    org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name 'cxf': Singleton bean creation not allowed while the singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implementation!)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:210)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
        at org.springframework.context.event.AbstractApplicationEventMulticaster.retrieveApplicationListeners(AbstractApplicationEventMulticaster.java:212)
        at org.springframework.context.event.AbstractApplicationEventMulticaster.getApplicationListeners(AbstractApplicationEventMulticaster.java:172)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:86)
        at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:335)
        at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1059)
        at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1020)
        at org.apache.cxf.bus.spring.SpringBus.destroyBeans(SpringBus.java:100)
        at org.apache.cxf.bus.CXFBusImpl.shutdown(CXFBusImpl.java:196)
        at org.apache.cxf.bus.CXFBusImpl.shutdown(CXFBusImpl.java:178)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:483)
    ......
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bdpToEcWebService' defined in URL [file:/D:/software/jboss/jboss-4.2.3.GA/server/default/deploy/newztjg.war/WEB-INF/classes/conf/golden/sdp/spring/applicationContext-webservice-sdp.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'fundBalanceService' of bean class [com.golden.sdp.webservice.servlet.impl.BdpToEcWebServiceImpl]: Bean property 'fundBalanceService' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1455) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1160) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328) ... 148 more Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'fundBalanceService' of bean class [com.golden.sdp.webservice.servlet.impl.BdpToEcWebServiceImpl]: Bean property 'fundBalanceService' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1044) at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:904) at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:75) at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:57) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1452) ... 156 more

    网上没有搜到解决办法,折腾好久
    最后静下心来,认认真真的在上面报的错中寻找出路,终于不负苦心人找到了问题所在问题就在于最底下报的这个问题,重复的注册了 fundBalanceService这个service

    Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'fundBalanceService' of bean class [com.golden.sdp.webservice.servlet.impl.BdpToEcWebServiceImpl]: Bean property 'fundBalanceService' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
        at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1044)
        at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:904)
        at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:75)
        at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:57)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1452)
        ... 156 more

    找到问题所在就好办了,解决问题,在重新启动  完美成功!