Bamboo does not launch: Application context refresh failed
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Bamboo does not launch and the logs show that the application context refresh failed due to a NullPointerException.
Diagnosis
The logs show a NullPointerException related to log4jAnalyticsLogger.
2021-08-09 20:04:50,484 ERROR [ThreadPoolAsyncTaskExecutor::Thread 13] [ExtenderConfiguration] Application context refresh failed (NonValidatingOsgiBundleXmlApplicationContext(bundle=com.atlassian.analytics.client, config=osgibundle:/META-INF/spring/*.xml))
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'bambooEventListener' defined in OSGi resource[classpath:com/atlassian/analytics/client/spring/product/BambooBeans.class|bnd.id=20|bnd.sym=com.atlassian.analytics.client]: Unsatisfied dependency expressed through method 'bambooEventListener' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'productAnalyticsEventListener' defined in OSGi resource[classpath:com/atlassian/analytics/client/spring/shared/SharedBeans.class|bnd.id=20|bnd.sym=com.atlassian.analytics.client]: Unsatisfied dependency expressed through method 'productAnalyticsEventListener' parameter 4; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'log4jAnalyticsLogger' defined in OSGi resource[classpath:com/atlassian/analytics/client/spring/shared/SharedBeans.class|bnd.id=20|bnd.sym=com.atlassian.analytics.client]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.atlassian.analytics.client.logger.Log4jAnalyticsLogger]: Factory method 'log4jAnalyticsLogger' threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:769)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:509)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1320)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1159)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:847)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877)
at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:57)
at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:322)
at org.eclipse.gemini.blueprint.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:287)
at org.eclipse.gemini.blueprint.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:137)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
[...]
Cause
The errors indicate that the user running Bamboo does not have full ownership of the Bamboo directories and its files, specifically the log files (as per the log4jAnalyticsLogger reference).
Solution
Double check if the user running Bamboo has full ownership of the entire <BAMBOO-HOME> directory, all its sub-folders and files.
Linux / macOS
Option 1: Change the ownership of the home directory and its contents, recursively:
sudo chown -R <BAMBOO-USER>: <BAMBOO_HOME_DIRECTORY>
Option 2: You can also run the following command to see a list of files and directories that are owned by any user other than the one running Bamboo:
find <BAMBOO_HOME_DIRECTORY> ! -user <BAMBOO_USER> -print
You can then change the ownership for those files individually:
sudo chown <BAMBOO_USER>: <PATH_TO_FILE>
Both options require Bamboo to be restarted in order for the changes to take effect.
Windows
- Right click on
<BAMBOO_HOME_DIRECTORY>
and hit Properties. - Navigate to the Security Tab and make sure that the user running Bamboo has Full Control of this folder.
- Upon any changes, you'll be prompted to either apply the same permissions to all sub-folders. Click Yes.
- Restart Bamboo.