Postgresql postgres r2dbc提供ssl错误,但使用jpa连接
r2dbc配置: jpa配置: jpa连接工作正常并返回结果,r2dbc无法连接到服务器,无法找到有效的证书 原因:sun.security.validator.validator异常:PKIX路径生成失败:sun.security.provider.certpath.SunCertPathBuilderException:找不到请求目标的有效证书路径 在r2dbc和ssl关闭的情况下,它表示pg_hba.conf没有主机条目。为什么它只要求使用r2dbc配置的证书 与r2dbc的依赖关系:Postgresql postgres r2dbc提供ssl错误,但使用jpa连接,postgresql,spring-boot,ssl,spring-data-r2dbc,r2dbc-postgresql,Postgresql,Spring Boot,Ssl,Spring Data R2dbc,R2dbc Postgresql,r2dbc配置: jpa配置: jpa连接工作正常并返回结果,r2dbc无法连接到服务器,无法找到有效的证书 原因:sun.security.validator.validator异常:PKIX路径生成失败:sun.security.provider.certpath.SunCertPathBuilderException:找不到请求目标的有效证书路径 在r2dbc和ssl关闭的情况下,它表示pg_hba.conf没有主机条目。为什么它只要求使用r2dbc配置的证书 与r2dbc的依赖关系:
org.springframework.boot
spring-boot-starter-data-r2dbc
org.springframework.boot
弹簧启动器webflux
io.r2dbc
r2dbc postgresql
运行时
org.postgresql
postgresql
运行时
对于jpa,我使用的是SpringWebStarter和JPAStarter,它们都是SpringVersion2.4.1。
我被这个问题困扰着,找不到这个错误的原因。欢迎使用任何解决方案。您需要将r2dbc url中的“sslmode”参数更改为“sslmode”。如果不将sslmode作为参数传递,R2dbc似乎会将sslmode默认为“verify full”,这就是为什么会出现无法找到证书的异常
spring:
profiles: default r2dbc:
url: r2dbc:postgresql://testserver.dev.net:1234/test?ssl=true&sslmode=require
username: test
password: test
connection_timeout: 20000
spring:
profiles: default
datasource:
url: jdbc:postgresql://testserver.dev.net:1234/test?ssl=true&sslmode=require
username: test
password: test
hikari:
connectionTimeout: 20000
maximumPoolSize: 5
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-r2dbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency> <dependency>
<groupId>io.r2dbc</groupId>
<artifactId>r2dbc-postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>