我能够分解 rds-combined-ca-bundle.pem 证书文件并将每个文件分别导入密钥库。然后我将 -Djavax.net.ssl.trustStore=path_to_truststore_file 和 -Djavax.net.ssl.trustStorePassword=password 添加到 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>
但是,在使用 HikariCp 的一个应用程序上,它会生成错误 javax.net.ssl.SSLException: Unsupported record version 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>
我在使用 HikariCp 的应用程序上做错了什么?