我能够分解rds-combined-ca-bundle.pem证书文件,并将每个文件分别导入密钥库。然后我添加了-Djavax.net.ssl.trustStore = path_to_truststore_file 和-Djavax.net.ssl.trustStorePassword =密码进入jvm选项。它使用jndi配置在一个应用程序上工作,如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<Context path="/contextname" unpackWAR="true" useNaming="true" swallowOutput="false">
<Resource removeAbandoned="true"
removeAbandonedTimeout="60"
name="jdbc/data" auth="Container"
type="javax.sql.DataSource"
maxActive="200"
maxIdle="60"
maxWait="20000"
username="rootuserssl"
password="rootusersslpassword"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://myinstance.123456789012.us-east-1.rds.amazonaws.com:3306/dbname?autoReconnect=true&verifyServerCertificate=true&requireSSL=true&useSSL=true"/>
</Context>
&#13;
但是,在使用HikariCp的一个应用程序中,它会生成错误javax.net.ssl.SSLException:不支持的记录版本Unknown-0.0。以下是配置。
<?xml version="1.0" encoding="UTF-8"?>
<Context path="/contextnametwo" unpackWAR="true" useNaming="true" swallowOutput="false">
<Resource name="jdbc/data" auth="Container"
driverClassName="com.mysql.jdbc.Driver"
jdbcUrl="jdbc:mysql://myinstance.123456789012.us-east-1.rds.amazonaws.com:3306/dbname?verifyServerCertificate=true&useSSL=true&requireSSL=true"
factory="com.zaxxer.hikari.HikariJNDIFactory"
type="javax.sql.DataSource"
maximumPoolSize="50"
connectionTestQuery="SELECT 1"
idleTimeout="300000"
maxLifetime="600000"
dataSource.implicitCachingEnabled="true"
dataSource.cachePrepStmts="true"
dataSource.prepStmtCacheSize="250"
dataSource.prepStmtCacheSqlLimit="2048"
dataSource.useServerPrepStmts="true"
catalog="dbname"
username="rootuserssl"
password="rootusersslpassword"
/>
</Context>
&#13;
在使用HikariCp的应用程序上我做错了什么?
答案 0 :(得分:0)
使用mariadb连接器(https://downloads.mariadb.org/connector-java/)而不是mysql解决了这个问题。工作就像一个魅力。