Initial Azure MySQL database connection attempt fails with error null java.lang.IllegalStateException
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. 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 throws a stack trace error when configuring the Database URL for Azure MySQL on the Setup Wizard page.
Environment
Bamboo 8.1.1
Diagnosis
The following stack trace will be thrown at the atlassian-bamboo.log file:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
2022-01-25 21:21:05,969 INFO [performSetupDatabaseConnectionBackgroundThread] [SetupDatabaseConnectionAction] Validating connection to url: [jdbc:mysql://db.mysql.database.azure.com:3306/bamboo?useSSL=false&autoReconnect=true&useUnicode=true&characterEncoding=utf8]
2022-01-25 21:21:07,426 INFO [performSetupDatabaseConnectionBackgroundThread] [SetupDatabaseConnectionAction] Database configuration is valid.
2022-01-25 21:21:07,455 ERROR [http-nio-8085-exec-3] [ExceptionMappingInterceptor] null
java.lang.IllegalStateException
at com.google.common.base.Preconditions.checkState(Preconditions.java:486)
at com.atlassian.bamboo.ww2.actions.setup.SetupUtilityBean.setupStandardDatabase(SetupUtilityBean.java:163)
at com.atlassian.bamboo.ww2.actions.setup.SetupDatabaseConnectionAction.lambda$execute$0(SetupDatabaseConnectionAction.java:92)
at com.atlassian.bamboo.setup.DefaultSetupPersister.executeSetupStep(DefaultSetupPersister.java:76)
at com.atlassian.bamboo.ww2.actions.setup.SetupDatabaseConnectionAction.execute(SetupDatabaseConnectionAction.java:90)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at ognl.OgnlRuntime.invokeMethodInsideSandbox(OgnlRuntime.java:1266)
at ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:1251)
at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1969)
at ognl.ObjectMethodAccessor.callMethod(ObjectMethodAccessor.java:68)
at com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethodWithDebugInfo(XWorkMethodAccessor.java:98)
at com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethod(XWorkMethodAccessor.java:90)
at ognl.OgnlRuntime.callMethod(OgnlRuntime.java:2045)
at ognl.ASTMethod.getValueBody(ASTMethod.java:97)
at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212)
at ognl.SimpleNode.getValue(SimpleNode.java:258)
at ognl.Ognl.getValue(Ognl.java:537)
at ognl.Ognl.getValue(Ognl.java:501)
at com.opensymphony.xwork2.ognl.OgnlUtil$3.execute(OgnlUtil.java:492)
at com.opensymphony.xwork2.ognl.OgnlUtil.compileAndExecuteMethod(OgnlUtil.java:544)
at com.opensymphony.xwork2.ognl.OgnlUtil.callMethod(OgnlUtil.java:490)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:438)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:293)
at org.apache.struts2.interceptor.BackgroundProcess$1.run(BackgroundProcess.java:55)
at java.base/java.lang.Thread.run(Thread.java:829)
Solution
Make sure to check all steps from our MySQL documentation when setting up the database before starting up the Bamboo instance.
As recommended for MySQL 8, install the MySQL Connector/J 8.0.26.
Checked if the database server is configured to use a storage engine InnoDB by default by running the query below, otherwise, ensure that your URL includes the sessionVariables=storage_engine=InnoDB flag.
1
mysql> show engines;
Result:
Engine | Support | Comment | Transactions | XA | Savepoints |
---|---|---|---|---|---|
InnoDB | DEFAULT | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
3. Check the global transaction isolation
level
is READ_COMMITTED by running the queries below:
1
2
SELECT @@GLOBAL.tx_isolation, @@GLOBAL.tx_read_only;
SELECT @@SESSION.tx_isolation, @@SESSION.tx_read_only;
If the level is not set to READ_COMMITTED please run the command below:
1
2
SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
⚠️ Run the first queries again to make sure it was set correctly.
4. Create a database with utf8
or utf8mb4_bin
character encoding.
1
2
3
4
mysql> CREATE DATABASE bamboo CHARACTER SET utf8 COLLATE utf8_bin;
mysql> GRANT ALL PRIVILEGES ON bamboo.* TO 'bamboouser'@'localhost' IDENTIFIED BY 'password';
mysql> FLUSH PRIVILEGES;
mysql> QUIT
Or:
1
2
3
4
mysql> CREATE DATABASE bamboo CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
mysql> GRANT ALL PRIVILEGES ON bamboo.* TO 'bamboouser'@'localhost' IDENTIFIED BY 'password';
mysql> FLUSH PRIVILEGES;
mysql> QUIT
5. Lastly for the database, run the below query to make sure the NO_AUTO_VALUE_ON_ZERO mode was disabled.
1
SELECT @@SQL_MODE, @@GLOBAL.SQL_MODE;
Once the database has been set up, please:
Start-up Bamboo
Enter the license key.
For the database URL page, add the following flags:
autoReconnect=true&useUnicode=true&characterEncoding=utf8&nullCatalogMeansCurrent=true
Your Database connection string should look similar to:
1
jdbc:mysql://<database-name>:3306/bamboo?autoReconnect=true&useUnicode=true&characterEncoding=utf8&nullCatalogMeansCurrent=true
Was this helpful?