Openshift MySQL “Communications Link Failure”

2019-09-03 11:27发布

问题:

I get the following error message when trying to connect a web app running on EAP6 to MySQL in OpenShift.

javax.persistence.PersistenceException: org.hibernate.exception.JDBCConnectionException: Communications link failure

How do I fix this?

回答1:

The same issue was discussed at https://community.jboss.org/thread/202318.

The solution is to append "?autoReconnect=true" to the connection URL. You do this in the standalone.xml file, found in the .openshift/config folder in your OpenShift Maven project.


EDIT

This is actually a known bug: https://community.jboss.org/thread/177144. Validating the connection can be used as a workaround.

<validation>
 <check-valid-connection-sql>SELECT 1</check-valid-connection-sql>
</validation>