Communications link failure Exception – WSO2 with MySQL [Fix]

Updated on September 29, 2021

In this tutorial, we will discuss how to fix the communication link failure exception that occurs while integrating WSO2 with the MySQL database. If you are new to WSO2, then quickly jump to this guide on the installation and configuration of WSO2 on CentOS. Also if you are using WSO2 on a production server, then it’s recommended to integrate it with the MySQL database instead of the embedded H2 database. Haven’t done it yet? Here’s a guide for integrating WSO2 with the MySQL database. Said that, if you are stuck with an error – CommunicationsException: Communications link failure, then here’s the fix.

Below is the MySQL configuration in deployment.toml

[database.shared_db]
type = "mysql"
url = "jdbc:mysql://localhost:3306/shared_db"
username = "sharedadmin"
password = "sharedadmin123"
driver="com.mysql.cj.jdbc.Driver"


[database.apim_db]
type = "mysql"
url = "jdbc:mysql://localhost:3306/apim_db"
username = "apimadmin"
password = "apimadmin123"
driver="com.mysql.cj.jdbc.Driver"

However, the API Manager failed to start with the below error message:

Caused by: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

Ahh! No worries, the fix is here.

To fix this issue, you need to disable SSL via the database connection URL in deployment.toml as shown below.

url = "jdbc:mysql://localhost:3306/shared_db?useSSL=false"

useSSL argument at the end of the connection URL will disable the SSL connection. Remember it is not advised from a security perspective, but if you are left with no solution, then this is a quick workaround.

Thanks to this answer in StackOverflow.

Was this article helpful?

Related Articles

Leave a Comment