Errors in the database setup screen during the Bamboo Wizard's setup
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
When attempting to configure a database in the database setup screen during the Bamboo wizard's setup, you may encounter the following error:
io.atlassian.util.concurrent.LazyReference$InitializationException: java.lang.NullPointerException at io.atlassian.util.concurrent.LazyReference.getInterruptibly(LazyReference.java:156) at io.atlassian.util.concurrent.LazyReference.get(LazyReference.java:116) at com.atlassian.bamboo.ww2.BambooFreemarkerManagerSoyHelpers$
Environment
This is observed in the Bamboo version 8.1.3 installation with a PostgreSQL database as well as Bamboo 9.2.1 with a MySQL database.
Diagnosis
As per the <Bamboo-Home>/logs/atlassian-bamboo.log file, an error [FiveOhOh] 500 Exception was thrown. java.lang.IllegalStateException is seen after the validation of the database configuration step.
Error accessing database: org.postgresql.util.PSQLException: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
..........
2022-03-23 12:57:41,551 INFO [performSetupDatabaseConnectionBackgroundThread] [SetupDatabaseConnectionAction] Database configuration is invalid: {}
2022-03-23 12:57:58,905 INFO [performSetupDatabaseConnectionBackgroundThread] [SetupDatabaseConnectionAction] Validating database configuration...
2022-03-23 12:57:58,905 INFO [performSetupDatabaseConnectionBackgroundThread] [SetupDatabaseConnectionAction] Validating connection to url: [jdbc:postgresql://localhost:5432/postgres]
2022-03-23 12:57:59,031 INFO [performSetupDatabaseConnectionBackgroundThread] [SetupDatabaseConnectionAction] Database configuration is valid.
2022-03-23 12:57:59,194 ERROR [http-nio-8085-exec-16] [FiveOhOh] 500 Exception was thrown.
java.lang.IllegalStateException
2022-03-23 12:57:59,385 ERROR [http-nio-8085-exec-16] [runtime] Error executing FreeMarker template
FreeMarker template error:
The following has evaluated to null or missing:
==> ctx.getSystemEncoding [in template "fragments/decorator/decorators.ftl" at line 8, column 22]
----
Tip: It's the step after the last dot that caused this error, not those before it.
----
Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use [#if myOptionalVar??]when-present[#else]when-missing[/#if]. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----
----
FTL stack trace ("~" means nesting-related):
- Failed at: ${ctx.getSystemEncoding()} [in template "fragments/decorator/decorators.ftl" in macro "displayHtmlHeader" at line 8, column 20]
- Reached through: @decorators.displayHtmlHeader require... [in template "decorators/focusTask.ftl" at line 3, column 1]
- Validation of the database connection URL was completed successfully. However, the next step of writing the database configuration to <Bamboo-Home>/bamboo.cfg.xml failed.
- The first thing the startup do after validating the connection with the database is to get information from the config file, more specifically from the <Bamboo-Home>/bamboo.cfg.xml and for some reason it seems to be failing to do so, possibly meaning the file is corrupted.
Cause
- This happens when Bamboo is not able to read the <Bamboo-home>/bamboo.cfg.xml file (or the file is corrupted). That can be caused by permission issues in the installation folder and in the <Bamboo-home> folder, or corrupted files for many other reasons.
- In this particular case, the issue was due to Bamboo being unable to read the <Bamboo-Home>/bamboo.cfg.xml file as it was in a corrupted state.
Solution
To fix the issue, we recommend you follow the below steps:
Please check the current running Bamboo process.
For Linux, the below command can be used:
ps aux | grep bamboo
For Windows, this can be checked from the task manager.
Kill or stop the current Bamboo process.
For Linux, the below command can be used:
kill -9 <bamboo_pid>
(where <bamboo_pid> can be found in the preceding step.)
For Windows, the Bamboo process can be stopped using the task manager or by stopping the Bamboo service from the command line.
Rename or move the <Bamboo-Home>/bamboo.cfg.xml file.
For linux, the below command can be used:
mv bamboo.cfg.xml bamboo.cfg.xml_bkp
- Start the Bamboo process now. Please make sure to start the process using the user configured separately for Bamboo and not the root user.
For Linux:
In the command line, change the directory to <Bamboo installation directory>
and run the commands to start Bamboo:
$ cd <Bamboo installation directory>
$ ./bin/start-bamboo.sh
For Windows:
In the command line, change the directory to <Bamboo installation directory>
and run the command to start Bamboo:
$ cd <Bamboo installation directory>
$ bin\start-bamboo.bat
- Please ensure that all Bamboo-related folders and files (<Bamboo-Install >, <Bamboo-Home >) are owned by the user who is used to start the Bamboo service.
- Restart the Bamboo wizard now.
- Verify if the <Bamboo-home>/bamboo.cfg.xml file was created with the correct permission (i.e, with bamboo user).
- Move forward with the installation.
- If the installation is successful without any issues, you'll see something like below in the<Bamboo-home>/logs/atlassian-bamboo.log file.
2022-03-24 15:08:45,488 INFO [performSetupDatabaseConnectionBackgroundThread] [SetupDatabaseConnectionAction] Validating database configuration...
2022-03-24 15:08:45,490 INFO [performSetupDatabaseConnectionBackgroundThread] [SetupDatabaseConnectionAction] Validating connection to url: [jdbc:postgresql://postgres:5432/bamboo]
2022-03-24 15:08:45,625 INFO [performSetupDatabaseConnectionBackgroundThread] [SetupDatabaseConnectionAction] Database configuration is valid.
2022-03-24 15:08:45,627 INFO [performSetupDatabaseConnectionBackgroundThread] [SetupUtilityBean] Setting up database: postgresql
2022-03-24 15:08:45,629 INFO [performSetupDatabaseConnectionBackgroundThread] [SetupUtilityBean] Bootstrapping database: postgresql
2022-03-24 15:08:45,657 INFO [performSetupDatabaseConnectionBackgroundThread] [DefaultHibernateConfigurator] Saving bootstrap configuration...
2022-03-24 15:08:45,672 INFO [performSetupDatabaseConnectionBackgroundThread] [DefaultHibernateConfigurator] Refreshing Spring context...
2022-03-24 15:08:50,746 INFO [performSetupDatabaseConnectionBackgroundThread] [HikariDataSource] HikariPool-1 - Starting...
2022-03-24 15:08:50,830 INFO [performSetupDatabaseConnectionBackgroundThread] [HikariDataSource] HikariPool-1 - Start completed.
2022-03-24 15:08:51,696 INFO [performSetupDatabaseConnectionBackgroundThread] [ResettableTableHiLoGenerator] Registering exportables...