Unable to connect to MySQL database - Exception attempting to load Database driver
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
Symptoms
Migrating to MySQL database fails and the following error is displayed in the web interface:
1
Unable to load database driver from your FISHEYE_INST/lib directory. Please check the JDBC driver jar is properly installed
The following warning is written in the FISHEYE_INST/var/log/atlassian-fisheye-<date>.log
:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2022-04-17 10:34:27,237 WARN [qtp1052317717-181 ] fisheye TestDBConnectionAjaxAction-checkDriverClass - Exception attempting to load Database driver
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at java.net.URLClassLoader.findClass(URLClassLoader.java:382) [?:1.8.0_241]
at java.lang.ClassLoader.loadClass(ClassLoader.java:418) [?:1.8.0_241]
at java.lang.ClassLoader.loadClass(ClassLoader.java:351) [?:1.8.0_241]
at java.lang.Class.forName0(Native Method) [?:1.8.0_241]
at java.lang.Class.forName(Class.java:348) [?:1.8.0_241]
at com.atlassian.crucible.actions.admin.database.TestDBConnectionAjaxAction.checkDriverClass(TestDBConnectionAjaxAction.java:57) [fisheye.jar:?]
at com.atlassian.crucible.actions.admin.database.TestDBConnectionAjaxAction.execute(TestDBConnectionAjaxAction.java:31) [fisheye.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [?:1.8.0_241]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [?:1.8.0_241]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [?:1.8.0_241]
at java.lang.reflect.Method.invoke(Method.java:498) [?:1.8.0_241]
...(truncated)
Environment
Fisheye / Crucible 2.9.x or newer.
Cause
As can be seen at Migrating to MySQL - Prerequisites, starting with Fisheye 2.9.x, the JDBC driver for MySQL is no longer bundled with Fisheye/Crucible due to MySQL licensing restrictions.
Resolution
Manually download and install the MySQL Connector/J JDBC driver version 5.1.49 because 8.x is known to cause issues.
Follow these steps:
Stop Fisheye / Crucible
Download the MySQL Connector/J JDBC driver 5.1.49 from this direct download link or access the download website, switch the Product Version dropdown to 5.1.49 and click the Download button.
Expand the downloaded
zip / tar.gz
file.Copy the
mysql-connector-java-5.1.XX-bin.jar
file from the extracted directory to yourFISHEYE_INST
/lib
directoryRemember that
FISHEYE_INST
is an environment variable which points to Fisheye's data directoryYou may need to create the
lib
directory insideFISHEYE_INST
Make sure that the user who starts Fisheye/Crucible has the proper file system permission to execute the jar file
Start Fisheye / Crucible
Was this helpful?