我正在尝试从Spring Boot应用程序连接到Vault服务器。 因此,我浏览了本指南:https://www.baeldung.com/spring-vault 并获取SSLHandshakeException:
WARN o.s.v.a.LifecycleAwareSessionManager - Cannot enhance VaultToken to a LoginToken: Token self-
lookup failed; nested exception is org.springframework.web.client.ResourceAccessException: I/O error
on GET request for
"https://*my vault server*/auth/token/lookup-
self": sun.security.validator.ValidatorException: PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path
to requested target; nested exception is 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
16:49:40.487 [http-nio-8084-exec-1] ERROR o.a.c.c.C.[.[.[.[dispatcherServlet] - Servlet.service() for
servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed;
nested exception is org.springframework.web.client.ResourceAccessException: I/O error on GET request
for "https://*my vault server*/":
sun.security.validator.ValidatorException: PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path
to requested target; nested exception is 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] with root cause
sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path
to requested target
因此,我将keystore.jks放在resources文件夹中,并将以下配置粘贴到application.yml:
spring.cloud.vault:
ssl:
trust-store: classpath:keystore.jks
trust-store-password: changeit
仍然出现错误。我究竟做错了什么? 有什么方法可以像我在Postman中一样将ssl验证设置为false?