Bamboo Upgrade process failing with LazyReference InitializationException post Database setup stage
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 Upgrade is failing post DB initialization stage with the below error.
ERROR [https-jsse-nio-8443-exec-4] [runtime] Error executing FreeMarker template
FreeMarker template error
io.atlassian.util.concurrent.LazyReference$InitializationException: java.lang.NullPointerException
at io.atlassian.util.concurrent.LazyReference.getInterruptibly(LazyReference.java:156)
Environment
Issue seen on Bamboo 8.1.3
Diagnosis
- During the Bamboo upgrade process post DB Initialization stage, Bamboo GUI fails to come up and below error message in seen on the screen.
- Bamboo Logs also confirm that the DB initialization was successful. Below log messages would be displayed.
INFO [performSetupDatabaseConnectionBackgroundThread] [SetupDatabaseConnectionAction] Validating connection to url:
INFO [performSetupDatabaseConnectionBackgroundThread] [SetupDatabaseConnectionAction] Database configuration is valid.
- Immediately post the above log messages 500 Exception related error would be present in the logs.
ERROR [FiveOhOh] 500 Exception was thrown.
ERROR [runtime] Error executing FreeMarker template
Cause
Below are the cause for the Issue
- Proper permission is not available to Bamboo user to <bamboo-home> and <bamboo-install> folders.
- Bamboo is not able to read the bamboo.cfg.xml file (or the file is corrupted).
Solution
Solution outlined will cover both the causes explained above.
Solution 1 : To provide proper permission to folders
The first step is to make sure proper permission is provided to bamboo folders and files are owned by user which is running Bamboo. Please run the below command
chown -R <user_name> <bamboo-home> chown -R <user_name> <bamboo-install>
where <user_name> is the user_id you're using to start the service.
Please include the -R parameter as it is important to make sure the ownership to all files and subfolders will also be adjusted.
Solution 2 : To regenerate bamboo.cfg.xml file.
Rename the bamboo.cfg.xml file with the below command
mv bamboo.cfg.xml bamboo.cfg.xml_bkp
Below steps would be common for both solution 1 and solution 2 defined above.
- Restart Bamboo and verify if the bamboo.cfg.xml file was created with the correct permission (bamboo user).
- Move forward with the installation.