Unable to Start Could not get JDBC Connection ClassNotFoundException com.mysql.jdbc.Driver

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

Bitbucket Server does not start and the following appears in the atlassian-bitbucket.log:

2015-01-10 09:12:24,941 ERROR [spring-startup]  c.a.j.s.w.s.JohnsonDispatcherServlet SpringMVC dispatcher [springMvc] could not be started
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'crowdUserDao' defined in class path resource [crowd-spi-context.xml]: Unsatisfied dependency expressed through constructor argument with index 0 of type [com.atlassian.event.api.EventPublisher]: : Error creating bean with name 'pluginConfiguration' defined in class path resource [bitbucket-context.xml]: Cannot resolve reference to bean 'pluginPersistentStateStore' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pluginPersistentStateStore' defined in class path resource [bitbucket-context.xml]: Cannot create inner bean 'com.atlassian.bitbucket.internal.plugin.DefaultPluginPersistentStateStore#5aeae692' of type [com.atlassian.bitbucket.internal.plugin.DefaultPluginPersistentStateStore] while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.atlassian.bitbucket.internal.plugin.DefaultPluginPersistentStateStore#5aeae692' defined in class path resource [bitbucket-context.xml]: Cannot resolve reference to bean 'pluginStateDao' while setting constructor argument; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'pluginStateDao' defined in URL [jar:file:/opt/atlassian/bitbucket/3.5.1/atlassian-bitbucket/WEB-INF/lib/bitbucket-dao-impl-3.5.1.jar!/com.atlassian.bitbucket/internal/plugin/HibernatePluginStateDao.class]: Unsatisfied dependency expressed through constructor argument with index 0 of type [org.hibernate.SessionFactory]: : Error creating bean with name 'sharedHomeLockAcquirer' defined in class path resource [bitbucket-context.xml]: Cannot resolve reference to bean 'licenseHelper' while setting constructor argument; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'licenseHelper' defined in URL [jar:file:/opt/atlassian/bitbucket/3.5.1/atlassian-bitbucket/WEB-INF/lib/bitbucket-service-impl-3.5.1.jar!/com.atlassian.bitbucket/internal/license/DefaultLicenseHelper.class]: Unsatisfied dependency expressed through constructor argument with index 2 of type [com.atlassian.bitbucket.internal.server.ApplicationPropertyDao]: : Error creating bean with name 'databaseSupplier': Invocation of init method failed; nested exception is org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: ------
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1324)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1177)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:190)
    ...

Cause

The MySQL JDBC driver has not been installed.

Resolution

Download and install the driver:

  1. Download the MySQL Connector/J JDBC driver from the download site.
  2. Expand the downloaded zip/tar.gz file.
  3. Copy the mysql-connector-java-5.1.XX-bin.jar file from the extracted directory to your: BITBUCKET_INSTALL/app/WEB-INF/lib directory (for Bitbucket Server 5.0 or later.  For Bitbucket 2.1 - 4.x the location for this driver is BITBUCKET_INSTALL/lib)
  4. Stop, and then restart Bitbucket Server. See Starting and stopping Bitbucket Server.

Last modified on Nov 2, 2018

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.