Hello,
I am trying to follow “couchbase for Java developer” course on couchbase academy. While trying to access the capella cluster, getting below error:
[cb-events] ERROR com.couchbase.io - [com.couchbase.io][SecureConnectionFailedEvent] Detected a TLS problem in the IO layer: javax.net.ssl.SSLHandshakeException: General OpenSslEngine problem, Cause: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target {"bucket":"travel-sample","coreId":"0x6279f9b900000001","local":"/100.64.0.1:51004","remote":"svc-dqis-node-001.d9atgx2youzqdzjk.cloud.couchbase.com/54.254.159.121:11207"}
[cb-events] ERROR com.couchbase.io - [com.couchbase.io][SecureConnectionFailedEvent] Detected a TLS problem in the IO layer: javax.net.ssl.SSLHandshakeException: General OpenSslEngine problem, Cause: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target {"coreId":"0x6279f9b900000001","local":"/100.64.0.1:51003","remote":"svc-dqis-node-001.d9atgx2youzqdzjk.cloud.couchbase.com/54.254.159.121:11207"}
[cb-events] WARN com.couchbase.endpoint - [com.couchbase.endpoint][EndpointConnectionFailedEvent][760ms] Connect attempt 1 failed because of DecoderException: javax.net.ssl.SSLHandshakeException: General OpenSslEngine problem {"bucket":"travel-sample","circuitBreaker":"DISABLED","coreId":"0x6279f9b900000001","remote":"svc-dqis-node-001.d9atgx2youzqdzjk.cloud.couchbase.com:11207","type":"KV"}
com.couchbase.client.core.deps.io.netty.handler.codec.DecoderException: javax.net.ssl.SSLHandshakeException: General OpenSslEngine problem
at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: javax.net.ssl.SSLHandshakeException: General OpenSslEngine problem
at java.base/javax.net.ssl.SSLEngine.wrap(SSLEngine.java:564)
... 1 more
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at java.base/sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:439)
at java.base/sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:306)
at java.base/sun.security.validator.Validator.validate(Validator.java:264)
at java.base/sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:285)
at java.base/sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:144)
... 1 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at java.base/sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:148)
at java.base/sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:129)
at java.base/java.security.cert.CertPathBuilder.build(CertPathBuilder.java:297)
at java.base/sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:434)
... 5 more
While I understand this is due to certificate but I have already downloaded the certificate from cluster->security certificate
section and using it in the code as follows:
Cluster cluster = Cluster.connect(
connectionString,
ClusterOptions.clusterOptions(username, password).environment(env -> {
// Sets a pre-configured profile called "wan-development" to help avoid
// latency issues when accessing Capella from a different Wide Area Network
// or Availability Zone (e.g. your laptop).
env.applyProfile("wan-development");
env
.securityConfig(security -> security
.enableTls(true)
// Tell the client to trust the cluster's root certificate.
// If your cluster's root certificate is from a well-known
// Certificate Authority (CA), you can skip this.
.trustCertificate(Paths.get("/Users/test/couchbase/CouchBaseJava/MyFirstCluster2025-root-certificate.cert")));
})
);
Even while running the cbimport
I got the similar issue for security certificate.
Could someone help on this.
Thanks