You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Tomasz Bech (JIRA)" <ji...@apache.org> on 2011/09/15 13:48:08 UTC

[jira] [Created] (CXF-3805) BeanInCreationException when CXF client factorybean used

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
            Priority: Critical
         Attachments: 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

        

[jira] [Updated] (CXF-3805) BeanInCreationException when CXF client factorybean used

Posted by "Tomasz Bech (JIRA)" <ji...@apache.org>.
     [ 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

> 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
>            Priority: Critical
>         Attachments: 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

        

[jira] [Resolved] (CXF-3805) BeanInCreationException when CXF client factorybean used

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-3805?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp resolved CXF-3805.
------------------------------

       Resolution: Fixed
    Fix Version/s: 2.4.3

> 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
>             Fix For: 2.4.3
>
>         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

        

[jira] [Assigned] (CXF-3805) BeanInCreationException when CXF client factorybean used

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-3805?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp reassigned CXF-3805:
--------------------------------

    Assignee: Daniel Kulp

> 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
>
>
> 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

        

[jira] [Commented] (CXF-3805) BeanInCreationException when CXF client factorybean used

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-3805?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13105393#comment-13105393 ] 

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: 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
>
>
> 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

        

[jira] [Commented] (CXF-3805) BeanInCreationException when CXF client factorybean used

Posted by "Tomasz Bech (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-3805?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13105923#comment-13105923 ] 

Tomasz Bech commented on CXF-3805:
----------------------------------

i've patched cxf localy (changing true->false in 3 places), and it seems it fixes the problem (context in our real project starts nicely).

> 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

        

[jira] [Updated] (CXF-3805) BeanInCreationException when CXF client factorybean used

Posted by "Tomasz Bech (JIRA)" <ji...@apache.org>.
     [ 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