mysql Payara JDBC Connection Pool throws exception after applying SSL

bvjveswy  于 2022-12-22  发布在  Mysql
关注(0)|答案(1)|浏览(121)

I'm using Payara's JDBC Connection Pool for a long time and it is working great by using the following setting :

  • user : xxxx
  • password : xxxxxx
  • url : jdbc:mysql://192.168.0.101:3306/webdb
  • characterEncoding : utf8
  • useSSL : false
  • autoReconnect : true

I haven't applied SSL because it is located at the same network. However, I need to migrate the MySql server to the remote network and I would like to upgrade the security of connection.

  • url : jdbc:mysql://xxx.xxx.xxx.xxx:3306/webdb (xxx.xxx.xxx.xxx is the public ip)
  • useSSL : true
  • verifyServerCertificate : false (the cert is not checked because the cert has not yet prepared)

However, I received the following error:
Caused by: java.net.SocketException: Broken pipe (Write failed) at java.base/java.net.SocketOutputStream.socketWrite0(Native Method) at java.base/java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:110) at java.base/java.net.SocketOutputStream.write(SocketOutputStream.java:150) at java.base/sun.security.ssl.SSLSocketOutputRecord.flush(SSLSocketOutputRecord.java:251) at java.base/sun.security.ssl.HandshakeOutStream.flush(HandshakeOutStream.java:89) at java.base/sun.security.ssl.CertificateVerify$T10CertificateVerifyProducer.produce(CertificateVerify.java:509) at java.base/sun.security.ssl.SSLHandshake.produce(SSLHandshake.java:436) at java.base/sun.security.ssl.ServerHelloDone$ServerHelloDoneConsumer.consume(ServerHelloDone.java:173) at java.base/sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:392) at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:444) at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:421) at java.base/sun.security.ssl.TransportContext.dispatch(TransportContext.java:178) at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:164) at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1152) at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1063) ... 97 more ]]
I can't confirm which setting or library causes this problems but the connection should be fine because I can connect the remote database by using Workbench (with SSL) and Payara JDBC Pool (Without SSL).
I have tried different setting but I am still can't get it working. Any help would be much appreciated.

9gm1akwq

9gm1akwq1#

In my case, setting the property fallbackToSystemKeyStore of MySQL Connector/J to false solved the problem.

相关问题