sporadic issue with opening connection and Mariadb
I am using jpa with Spring and Hibernate and testing my application with MariaDB. It is mostly working but then every once in awhile (cannot detect any pattern) I am seeing sporadic Errors like the one below. I am going against a single database machine and we have made sure that there are no firewall preventing access between my application server and the database server. Most of the time the database calls are successful - just periodically they are not. I have been using jmeter to simulate load to help me reproduce the issue.
What is causing this problem and how can I correct it?
I am using the following properties in my connection (removed our hostname, dbname, port,etc for security reasons):
dataSource.url=jdbc:mariadb:<our db hostname: port>/<db-name>?trustServerCertificate=true&useSSL=true&dumpQueriesOnException=true&ssl-cert=/home/hrf/credMgmtDbCerts/client-cert.pem&ssl-key=/home/hrf/credMgmtDbCerts/client-key.pem
dataSource.driverClassName=org.mariadb.jdbc.Driver dataSource.dialect=org.hibernate.dialect.MySQL5Dialect dataSource.user=<username> dataSource.password=<password>
Here is the relevant part of the stack trace I am seeing -->
Caused by: javax.persistence.PersistenceException: org.hibernate.exception.JDBCConnectionException: Could not open connection at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1387) at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1310) at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:1397) at org.hibernate.ejb.TransactionImpl.begin(TransactionImpl.java:62) at org.springframework.orm.jpa.DefaultJpaDialect.beginTransaction(DefaultJpaDialect.java:67) at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:380) ... 39 more Caused by: org.hibernate.exception.JDBCConnectionException: Could not open connection at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:67) at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:110) at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:221) at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.getConnection(LogicalConnectionImpl.java:157) at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.doBegin(JdbcTransaction.java:67) at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.begin(AbstractTransactionImpl.java:160) at org.hibernate.internal.SessionImpl.beginTransaction(SessionImpl.java:1432) at org.hibernate.ejb.TransactionImpl.begin(TransactionImpl.java:59) ... 41 more Caused by: java.sql.SQLNonTransientConnectionException: Could not connect to <hostname:port>: Unsupported record version Unknown-0.0 at org.mariadb.jdbc.internal.SQLExceptionMapper.get(SQLExceptionMapper.java:136) at org.mariadb.jdbc.internal.SQLExceptionMapper.throwException(SQLExceptionMapper.java:106) at org.mariadb.jdbc.MySQLDataSource.getConnection(MySQLDataSource.java:291) at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:70) at org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:292) at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:214) ... 46 more Caused by: org.mariadb.jdbc.internal.common.QueryException: Could not connect to <hostname:port>: Unsupported record version Unknown-0.0 at org.mariadb.jdbc.internal.mysql.MySQLProtocol.connect(MySQLProtocol.java:513) at org.mariadb.jdbc.internal.mysql.MySQLProtocol.connect(MySQLProtocol.java:673) at org.mariadb.jdbc.internal.mysql.MySQLProtocol.<init>(MySQLProtocol.java:266) at org.mariadb.jdbc.MySQLDataSource.getConnection(MySQLDataSource.java:289) ... 49 more Caused by: javax.net.ssl.SSLException: Unsupported record version Unknown-0.0 at sun.security.ssl.InputRecord.readV3Record(InputRecord.java:524) at sun.security.ssl.InputRecord.read(InputRecord.java:509) at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:927) at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1312) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1339) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1323) at org.mariadb.jdbc.internal.mysql.MySQLProtocol.connect(MySQLProtocol.java:444) ... 52 more
Your help is greatly appreciated. Thank you. Helen Feder Principal Systems Software Engineer Carnegie Mellon University
Answer Answered by Daniel Black in this comment.
This looks similar to http://stackoverflow.com/questions/16898126/disable-keystore-on-jdbc-connection