activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (AMQ-2960) PooledConnectionFactoryBean returns null in OSGi env sometimes
Date Sat, 02 Nov 2013 20:29:17 GMT

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

Claus Ibsen updated AMQ-2960:
-----------------------------

    Fix Version/s: 5.10.0

> 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.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.1#6144)

Mime
View raw message