Bitbucket is not starting with MySQL error "No appropriate protocol"

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

Bitbucket connected to MySQL Database does not start and throws the below error message which is related to MySQL TLS supported version and not appropriated protocol passed via JDBC URL.

1 2 3 4 5 6 2022-11-14 09:07:28,313 ERROR [spring-startup] com.zaxxer.hikari.pool.HikariPool bitbucket - Exception during pool initialization. com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet successfully received from the server was 0 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago. Caused by: javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)

Environment

  • Bitbucket 7+

  • MySQL Database configured as external DB

Diagnosis

Bitbucket does not start and the following error message can be found on atlassian-bitbucket.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 33 34 35 36 37 38 39 2022-11-14 09:07:28,313 ERROR [spring-startup] com.zaxxer.hikari.pool.HikariPool bitbucket - Exception during pool initialization. com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet successfully received from the server was 0 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago. at sun.reflect.GeneratedConstructorAccessor55.newInstance(Unknown Source) at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:990) at com.mysql.jdbc.ExportControlled.transformSocketToSSLSocket(ExportControlled.java:201) at com.mysql.jdbc.MysqlIO.negotiateSSLConnection(MysqlIO.java:4869) at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1656) at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1217) at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2189) at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2220) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2015) at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:768) at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47) at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:385) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:323) at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138) at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:364) at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206) at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:476) at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561) at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115) at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:81) at com.atlassian.stash.internal.hikari.ExtendedHikariDataSource.<init>(ExtendedHikariDataSource.java:49) at com.atlassian.stash.internal.hikari.HikariDataSourceFactory.create(HikariDataSourceFactory.java:70) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) at javax.servlet.GenericServlet.init(GenericServlet.java:158) at java.lang.Thread.run(Thread.java:750) ... 111 frames trimmed Caused by: javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate) at sun.security.ssl.HandshakeContext.<init>(HandshakeContext.java:171) at sun.security.ssl.ClientHandshakeContext.<init>(ClientHandshakeContext.java:103) at sun.security.ssl.TransportContext.kickstart(TransportContext.java:220) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:433) at com.mysql.jdbc.ExportControlled.transformSocketToSSLSocket(ExportControlled.java:186)

Cause

The error relates with MySQL and TLS protocols and this error is mentioned in the MySQL :: MySQL Connector/J 8.0 Developer Guide :: 16 Known Issues and Limitations article.

Connector/J does not enable connections with TLSv1.2 and higher by default due to compatibility issues when connecting to servers that restrict connections to use those higher TLS versions, you might encounter com.mysql.cj.exceptions.CJCommunicationsException:javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate).

You need to enable connections with TLSv1.2 and higher versions using the enabledTLSProtocols connection property. See Section 6.8, “Connecting Securely Using SSL” for details.

Solution

There are two possible solutions for this problem, either disable the TLS or properly set the TLS versions that will be used on the Bitbucket connection to MySQL. Bitbucket should be stopped prior to applying the changes.

  • Set the connection to use TLSv1.2. Edit my.cnf file including the following:

1 2 [mysqld] tls_version=TLSv1.2

Edit bitbucket.properties JDBC connection URL, using enabledTLSProtocolsproperty, like below:

1 jdbc:mysql://localhost:3306/bitbucketdb?enabledTLSProtocols=TLSv1.2
  •  Or disable the secure SSL on the database connection:

Edit my.cnf file including the following:

1 2 3 [mysqld] ... skip_ssl

Edit bitbucket.properties JDBC connection URL, using useSSL=falseproperty

1 jdbc:mysql://localhost:3306/bitbucketdb?useSSL=false

After performing the changes, start Bitbucket again and confirm it is working.

Updated on March 6, 2025

Still need help?

The Atlassian Community is here for you.