You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Arthur Naseef (JIRA)" <ji...@apache.org> on 2014/06/07 23:09:01 UTC

[jira] [Commented] (AMQ-2960) PooledConnectionFactoryBean returns null in OSGi env sometimes

    [ https://issues.apache.org/jira/browse/AMQ-2960?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14020972#comment-14020972 ] 

Arthur Naseef commented on AMQ-2960:
------------------------------------

Git commit: https://git-wip-us.apache.org/repos/asf?p=activemq.git;a=commit;h=4ddbb8546d7ca50b57213da45f3fbd021ef7fe69

> PooledConnectionFactoryBean returns null in OSGi env sometimes
> --------------------------------------------------------------
>
>                 Key: AMQ-2960
>                 URL: https://issues.apache.org/jira/browse/AMQ-2960
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker
>         Environment: ServiceMix-4.2.0-fuse-02-00, spring-osgi 1.2.1, spring 2.5.6.SEC02
>            Reporter: Volodymyr Buell
>            Assignee: Claus Ibsen
>             Fix For: 5.9.1, 5.10.0
>
>         Attachments: PooledConnectionFactoryBean-lazy-initialization-workaround-for-null.patch
>
>
> From time to time PooledConnectionFactoryBean failed to initialize itself correctly in ServiceMix 4 (FUSE actually). From activemq-broker.xml:
> Exception in thread "SpringOsgiExtenderThread-20" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pooledConnectionFactory' defined in URL [bundleentry://110.fwk173823/META-INF/spring/activemq-broker.xml]: factory-bean 'pooledConnectionFactoryFactory' returned null
> 	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:289)
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:903)
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:817)
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
> 	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
> 	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
> 	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
> 	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
> 	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
> 	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
> 	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
> 	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)
> 	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)
> 	at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
> 	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)
> 	at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)
> 	at java.lang.Thread.run(Thread.java:619)
> The problem is that Spring sometimes invokes @PreConstruct *AFTER* the getObject() has been used for dependent beans constructing. Therefore PooledConnectionFactoryBean.getObject() returns null.
> Lazy initialization is fixing this issue:
>     public Object getObject() throws Exception {
>         if (pooledConnectionFactory == null)
>         {
>             afterPropertiesSet();
>         }
>         return pooledConnectionFactory;
>     }



--
This message was sent by Atlassian JIRA
(v6.2#6252)