Return-Path: X-Original-To: apmail-cxf-issues-archive@www.apache.org Delivered-To: apmail-cxf-issues-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6F54F8F5F for ; Thu, 15 Sep 2011 14:38:30 +0000 (UTC) Received: (qmail 1240 invoked by uid 500); 15 Sep 2011 14:38:30 -0000 Delivered-To: apmail-cxf-issues-archive@cxf.apache.org Received: (qmail 1219 invoked by uid 500); 15 Sep 2011 14:38:30 -0000 Mailing-List: contact issues-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list issues@cxf.apache.org Received: (qmail 1209 invoked by uid 99); 15 Sep 2011 14:38:30 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Sep 2011 14:38:30 +0000 X-ASF-Spam-Status: No, hits=-2000.5 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Sep 2011 14:38:29 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id E0E209BD33 for ; Thu, 15 Sep 2011 14:38:08 +0000 (UTC) Date: Thu, 15 Sep 2011 14:38:08 +0000 (UTC) From: "Daniel Kulp (JIRA)" To: issues@cxf.apache.org Message-ID: <395988193.30996.1316097488917.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1594489762.30491.1316087288940.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (CXF-3805) BeanInCreationException when CXF client factorybean used MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ 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: > > > > > 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