cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Kulp (JIRA)" <>
Subject [jira] [Commented] (CXF-3805) BeanInCreationException when CXF client factorybean used
Date Thu, 15 Sep 2011 14:38:08 GMT


Daniel Kulp commented on CXF-3805:

Any chance you can re-attach the zip and check the "grant license to Apache" checkbox?   I
can then add this directly in the test suite.

I do have a fix coming.  It's something I saw a month or so ago and questioned to myself,
but didn't mess with it at the time as I was afraid to do anything about it.   The calls to
getBeanNamesForType have a flag to eagerly init things that we are setting to true.   When
I saw that it did raise concerns in my head, but didn't have time to really figure out if
it's an issue or not.  Apparently it is.   Changing that flag to false fixes your testcase
(and doesn't seem to break any of our other tests).

> BeanInCreationException when CXF client factorybean used
> --------------------------------------------------------
>                 Key: CXF-3805
>                 URL:
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-WS Runtime
>    Affects Versions: 2.4.2
>            Reporter: Tomasz Bech
>            Assignee: Daniel Kulp
>            Priority: Critical
>         Attachments:
> In complex spring context, when JaxWsProxyFactoryBean is used, context fails to start
with BeanCurrentlyInCreationException.
> Part of exception:
>         at
> nNamesForType(
>         at org.apache.cxf.bus.spring.SpringBeanLocator.getBeansOfType(SpringBean
>         at org.apache.cxf.bus.CXFBusImpl.getExtension(
>         at org.apache.cxf.service.factory.AbstractServiceFactoryBean.setBus(Abst
>         at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.initializeSe
> rviceFactory(
>         at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoi
> nt(
>         at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.ja
> va:90)
>         at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFact
>         at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBe
> ...
> 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
> doGetObjectFromFactoryBean(
>         at
> getObjectFromFactoryBean(
>         at
> ctForBeanInstance(
>         at
> an(
>         at
> (
>         at
> .resolveReference(
>         ... 133 more
> The main reason of the problem is that JaxWsProxyFactoryBean calls spring getBeanNamesForType,
> 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:


View raw message