cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tomasz Bech (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CXF-3805) BeanInCreationException when CXF client factorybean used
Date Fri, 16 Sep 2011 05:18:09 GMT

     [ https://issues.apache.org/jira/browse/CXF-3805?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Tomasz Bech updated CXF-3805:
-----------------------------

    Attachment: beanincreationexction.zip

as you wish :)

> BeanInCreationException when CXF client factorybean used
> --------------------------------------------------------
>
>                 Key: CXF-3805
>                 URL: https://issues.apache.org/jira/browse/CXF-3805
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-WS Runtime
>    Affects Versions: 2.4.2
>            Reporter: Tomasz Bech
>            Assignee: Daniel Kulp
>            Priority: Critical
>         Attachments: beanincreationexction.zip, beanincreationexction.zip
>
>
> In complex spring context, when JaxWsProxyFactoryBean is used, context fails to start
with BeanCurrentlyInCreationException.
> Part of exception:
>         at org.springframework.context.support.AbstractApplicationContext.getBea
> nNamesForType(AbstractApplicationContext.java:1136)
>         at org.apache.cxf.bus.spring.SpringBeanLocator.getBeansOfType(SpringBean
> Locator.java:89)
>         at org.apache.cxf.bus.CXFBusImpl.getExtension(CXFBusImpl.java:99)
>         at org.apache.cxf.service.factory.AbstractServiceFactoryBean.setBus(Abst
> ractServiceFactoryBean.java:98)
>         at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.initializeSe
> rviceFactory(AbstractWSDLBasedEndpointFactory.java:232)
>         at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoi
> nt(AbstractWSDLBasedEndpointFactory.java:100)
>         at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.ja
> va:90)
>         at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFact
> oryBean.java:153)
>         at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBe
> an.java:151)
> ...
> Caused by: org.springframework.beans.factory.BeanCurrentlyInCreationException: E
> rror creating bean with name 'testBeanBBO': org.springframework.beans.factory.Fa
> ctoryBeanNotInitializedException: FactoryBean is not fully initialized yet
>         at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.
> doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:146)
>         at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.
> getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:109)
>         at org.springframework.beans.factory.support.AbstractBeanFactory.getObje
> ctForBeanInstance(AbstractBeanFactory.java:1429)
>         at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe
> an(AbstractBeanFactory.java:245)
>         at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
> (AbstractBeanFactory.java:190)
>         at org.springframework.beans.factory.support.BeanDefinitionValueResolver
> .resolveReference(BeanDefinitionValueResolver.java:322)
>         ... 133 more
> The main reason of the problem is that JaxWsProxyFactoryBean calls spring getBeanNamesForType,
which
> needs to instantiate all spring beans - and it is very easy to reach the case, that in
spring context
> in creation there are beans not fully initialized yet - and when getBeanNamesForType
is called - BIG BUM - exception.
> It is not proper pattern to use spring getBeanNamesForType from FactoryBean.create method.
> I've tracked the problem and isolated simple test case - it is attached.
> Unpack it into apache-cxf-2.4.2-src\apache-cxf-2.4.2-src\systests\jaxws\src\test\java
> and run:
> mvn -Dtest=BeanInCreationExceptionTest test
> It fails for spring2 and spring3 as well.
> When you look at beans.xml, you will see that there are no circular dependencies which
usually cause 
> BeanCurrentlyInCreationException - but JaxWsProxyFactoryBean.create is making the problem.
> Just comment one line as below in beans.xml:
> 	<bean id="testBeanBBOImpl" class="org.apache.cxf.systest.beanincreationexception.TestBeanABOImpl">
> 		<property name="bean" ref="testBeanABO"/>
> <!--  		<property name="client" ref="client2"/> --> 
> 	</bean>
> and test runs ok.
> How to fix? Provide lighter version (or a switch) of JaxWsProxyFactoryBean - it can just
create the proxy,
> and the rest (endpoint, client, all the stuff which requires getBeanNamesForType) can
be instantiated later - for example in AfterpropertiesSet phase.
> Or avoid getBeanNamesForType if possible.
> Now the workaround we try, is to change the order of spring beans xml's and have a luck.
Eventually changing from injecting client service/portType to
> getting them from applicationcontext.getBean - but it is not good practice.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message