簡體   English   中英

在Hibernate中使用MySQL RDS啟用SSL

[英]Enabling SSL with MySQL RDS in Hibernate

我正在嘗試從Hibernate安全地連接到RDS實例。 我的hibernate.cfg文件中的相關屬性如下所示。

<property name="connection.url">
            jdbc:mysql://<endpoint>/<db>?autoReconnect=true&amp;useUniCode=true&amp;characterEncoding=UTF-8&amp;useSSL=true     
</property>
<property name="dialect"> org.hibernate.dialect.MySQLDialect </property>    
<property name="connection.verifyServerCertificate">false</property>
<property name="connection.requireSSL">true</property>

但是我正在追隨異常。

Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

我是否還需要在RDS實例上配置某些內容?

謝謝,

我能夠解決此問題,但尚不知道根本原因。

以某種方式單獨添加這些連接屬性不起作用,但是當我將它們作為參數添加到連接URL中時,它起作用了。

 jdbc:mysql://<endpoint>/<db>?autoReconnect=true&useUniCode=true&characterEncoding=UTF-8&useSSL=true&verifyServerCertificate=false&requireSSL=true

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM