org.springframework.beans.factory.BeanCreationException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • Confluence theme plugin can fail to come up. Seen in build: https://bamboo.extranet.atlassian.com/browse/JST-JST-JOBE-787 Confluence log shows: {noformat} 2011-08-30 20:12:25,573 ERROR [Spring executor 9] [plugin.osgi.factory.OsgiPlugin] onSpringContextFailed Unable to start the Spring context for plugin com.atlassian.studio.confluence.common org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'confluencePluginEnabler' defined in URL [bundle://80.0:0/META-INF/spring/atlassian-plugins-components.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Could not enable plugincom.atlassian.studio.confluence at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473) 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.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) Caused by: java.lang.IllegalStateException: Could not enable plugincom.atlassian.studio.confluence at com.atlassian.studio.confluence.common.ConfluencePluginEnabler.enablePlugin(ConfluencePluginEnabler.java:61) at com.atlassian.studio.confluence.common.ConfluencePluginEnabler.enableCorrectConfluencePlugin(ConfluencePluginEnabler.java:52) at com.atlassian.studio.confluence.common.ConfluencePluginEnabler.afterPropertiesSet(ConfluencePluginEnabler.java:37) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335) ... 19 more {noformat} Immediately after calling pluginController.enablePlugins(), ConfluencePluginEnabler checks pluginAccessor.isPluginEnabled(): {code:java} private void enablePlugin(String pluginKey) { pluginController.enablePlugins(pluginKey); if (!pluginAccessor.isPluginEnabled(pluginKey)) { throw new IllegalStateException("Could not enable plugin" + pluginKey); } log.info("Enabled plugin " + pluginKey); } {code} This check verifies the plugin state, which seems to be set synchronously via the enablePlugins() call. Therefore, a theory is that another thread is disabling the plugin at the same time. There is no evidence of this in the logs, and there appears to be no logging at the Felix level for the events of interest (in {{org.apache.felix.framework.Felix.stopBundle(BundleImpl, boolean)}}). If this re-occurs: * Verify that the enablePlugins() call, when running in conjunction with {{ConfluencePluginManager}}, does indeed behave synchronously. Note that {{ConfluencePluginManager}} does not set the plugin state directly, but listens for an {{ApplicationEvent}} (see {{com.atlassian.confluence.event.ConfluenceEventPublisherManager.publish(Object)}}), which delegates to org.springframework.context.ApplicationContext. From the [Spring doc|http://static.springsource.org/spring/docs/3.1.0.M2/spring-framework-reference/html/beans.html#context-functionality-events]: "You may register as many event listeners as you wish, but note that *by default event listeners receive events synchronously*." - so it *could* be asynchronous. * Consider implementing a {{BundleListener}} that logs for OSGi events to give us more information about who could be disabling the plugin and why. This logging {{BundleListener}} will not be enabled in time if registerd via Spring DM - it must be enabled via {{BundleActivator}}.
    via by Fabian Krämer,
  • Confluence theme plugin can fail to come up. Seen in build: https://bamboo.extranet.atlassian.com/browse/JST-JST-JOBE-787 Confluence log shows: {noformat} 2011-08-30 20:12:25,573 ERROR [Spring executor 9] [plugin.osgi.factory.OsgiPlugin] onSpringContextFailed Unable to start the Spring context for plugin com.atlassian.studio.confluence.common org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'confluencePluginEnabler' defined in URL [bundle://80.0:0/META-INF/spring/atlassian-plugins-components.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Could not enable plugincom.atlassian.studio.confluence at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473) 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.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) Caused by: java.lang.IllegalStateException: Could not enable plugincom.atlassian.studio.confluence at com.atlassian.studio.confluence.common.ConfluencePluginEnabler.enablePlugin(ConfluencePluginEnabler.java:61) at com.atlassian.studio.confluence.common.ConfluencePluginEnabler.enableCorrectConfluencePlugin(ConfluencePluginEnabler.java:52) at com.atlassian.studio.confluence.common.ConfluencePluginEnabler.afterPropertiesSet(ConfluencePluginEnabler.java:37) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335) ... 19 more {noformat} Immediately after calling pluginController.enablePlugins(), ConfluencePluginEnabler checks pluginAccessor.isPluginEnabled(): {code:java} private void enablePlugin(String pluginKey) { pluginController.enablePlugins(pluginKey); if (!pluginAccessor.isPluginEnabled(pluginKey)) { throw new IllegalStateException("Could not enable plugin" + pluginKey); } log.info("Enabled plugin " + pluginKey); } {code} This check verifies the plugin state, which seems to be set synchronously via the enablePlugins() call. Therefore, a theory is that another thread is disabling the plugin at the same time. There is no evidence of this in the logs, and there appears to be no logging at the Felix level for the events of interest (in {{org.apache.felix.framework.Felix.stopBundle(BundleImpl, boolean)}}). If this re-occurs: * Verify that the enablePlugins() call, when running in conjunction with {{ConfluencePluginManager}}, does indeed behave synchronously. Note that {{ConfluencePluginManager}} does not set the plugin state directly, but listens for an {{ApplicationEvent}} (see {{com.atlassian.confluence.event.ConfluenceEventPublisherManager.publish(Object)}}), which delegates to org.springframework.context.ApplicationContext. From the [Spring doc|http://static.springsource.org/spring/docs/3.1.0.M2/spring-framework-reference/html/beans.html#context-functionality-events]: "You may register as many event listeners as you wish, but note that *by default event listeners receive events synchronously*." - so it *could* be asynchronous. * Consider implementing a {{BundleListener}} that logs for OSGi events to give us more information about who could be disabling the plugin and why. This logging {{BundleListener}} will not be enabled in time if registerd via Spring DM - it must be enabled via {{BundleActivator}}.
    via by Fabian Krämer,
    • org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'confluencePluginEnabler' defined in URL [bundle://80.0:0/META-INF/spring/atlassian-plugins-components.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Could not enable plugincom.atlassian.studio.confluence at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473) 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.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) Caused by: java.lang.IllegalStateException: Could not enable plugincom.atlassian.studio.confluence at com.atlassian.studio.confluence.common.ConfluencePluginEnabler.enablePlugin(ConfluencePluginEnabler.java:61) at com.atlassian.studio.confluence.common.ConfluencePluginEnabler.enableCorrectConfluencePlugin(ConfluencePluginEnabler.java:52) at com.atlassian.studio.confluence.common.ConfluencePluginEnabler.afterPropertiesSet(ConfluencePluginEnabler.java:37) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335) ... 19 more
    No Bugmate found.