I am trying to connect securely to RDS instance from Hibernate. Relevant properties in my hibernate.cfg file looks like this.
jdbc:mysql:///?autoReconnect=true&useUniCode=true&characterEncoding=UTF-8&useSSL=true
org.hibernate.dialect.MySQLDialect
false
true
But I am getting following exception.
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
Do I need to configure something on my RDS instance as well?
Thanks,
解决方案
I was able to fix this but don't know root cause yet.
Somehow adding these connection properties separately was not working but when I added them as parameters in connection URL, it worked.
jdbc:mysql:///?autoReconnect=true&useUniCode=true&characterEncoding=UTF-8&useSSL=true&verifyServerCertificate=false&requireSSL=true