Driver class can not be found in the class path
Asked by Steve Cuthbertson:

Hello - I am trying without success to install Bamboo as a learning exercise. I get MySQL installed and configured, but when I launch the URL and get to http://{server}:8085/setup/setupDatabaseConnection.action?selectedDatabase=mysql I had a message "Driver class can not be found in the class path". I downloaded and installed the driver with "yum install mysql-connector-java" and copied /usr/share/java/mysql-connector-j.jar to /var/bamboo/bamboo-home/atlassian-bamboo/WEB-INF/lib/ but now when I reload the page I just get a huge error that starts:

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...

What am I doing wrong?

$CLASSPATH is not set - is that where Bamboo is looking?

Should I set it to /usr/share/java?

I've had this on CentOS7 and now I'm on CentOS Stream 8.

Thanks!


Answers:
author: Vani
body: Hi [@Steve Cuthbertson](/t5/user/viewprofilepage/user-id/5050441) ,

Thank you for contacting Atlassian Community.

We understand you are trying to connect to Bamboo with your Mysql Database. Please follow this documentation on [how to connect Bamboo to a MySQL database.](https://confluence.atlassian.com/bamboo0802/mysql-1103433989.html)

1. Download the MySQL Connector/J JDBC driver 5.1 from the [download site](https://dev.mysql.com/downloads/connector/j/5.1.html).
2. Extract the downloaded zip/tar.gz file.
3. Copy the mysql-connector-java-5.1.XX-bin.jar file from the extracted directory to the` `<Bamboo installation directory>/lib directory (create the `lib/` directory if it doesn't already exist).  
   If you are using the Java Service Wrapper to start your Bamboo instance (`Bamboo/wrapper/run-bamboo start`), copy the mysql-connector-java-5.1.XX-bin.jar file to `<Bamboo installation directory>` `/wrapper/lib directory.`
4. Stop Bamboo on [Windows](https://confluence.atlassian.com/bamboo0802/installing-bamboo-on-windows-1103432723.html), [Linux](https://confluence.atlassian.com/bamboo0802/installing-bamboo-on-linux-1103432712.html) or [Mac](https://confluence.atlassian.com/bamboo0802/installing-bamboo-on-mac-os-x-1103432717.html).
5. Restart Bamboo on [Windows](https://confluence.atlassian.com/bamboo0802/installing-bamboo-on-windows-1103432723.html), [Linux](https://confluence.atlassian.com/bamboo0802/installing-bamboo-on-linux-1103432712.html) or [Mac](https://confluence.atlassian.com/bamboo0802/installing-bamboo-on-mac-os-x-1103432717.html).

We assume your Bamboo-install directory is /var/bamboo/bamboo-home/

Please let us know if you have any questions.

Thanks

Vani

comments: author: Steve Cuthbertson
body: Thanks Vani, I may have got a little further. If I use the connection string:

jdbc:mysql://localhost/bamboo?autoReconnect=true\&useUnicode=true\&characterEncoding=utf8\&sessionVariables=storage_engine=InnoDB

I get an error in atlassian-bamboo.log:

Unknown system variable 'storage_engine'

If I take that out of the string this is what I see:

2022-10-12 09:16:32,327 INFO \[performSetupDatabaseConnectionBackgroundThread\] \[SetupDatabaseConnectionAction\] Validating database configuration...  
2022-10-12 09:16:32,328 INFO \[performSetupDatabaseConnectionBackgroundThread\] \[SetupDatabaseConnectionAction\] Validating connection to url: \[jdbc:mysql://localhost/bamboo?autoReconnect=true\&useUnicode=true\&characterEncoding=utf8\]  
2022-10-12 09:16:32,452 INFO \[performSetupDatabaseConnectionBackgroundThread\] \[SetupDatabaseConnectionAction\] Database configuration is valid.

... but the next lines are:

2022-10-12 09:16:32,480 ERROR \[http-nio-8085-exec-8\] \[ExceptionMappingInterceptor\] null  
java.lang.IllegalStateException: null  
at com.google.common.base.Preconditions.checkState(Preconditions.java:486) \~\[guava-31.0.1-jre.jar:?\]  
at com.atlassian.bamboo.ww2.actions.setup.SetupUtilityBean.setupStandardDatabase(SetupUtilityBean.java:160) \~\[atlassian-bamboo-web-9.0.0.jar:?\]  
..2022-10-12 09:16:32,517 ERROR \[http-nio-8085-exec-8\] \[FiveOhOh\] 500 Exception was thrown.

I think this is progress, but not sure.  
Any ideas?  
Steve