Hi,
I am using Couchbase Server 6.6 and I am going to setup SSL connection.
Guys gave certificate and password but I always has error:
ConfigurationException: Could not open bucket.
My working code without SSL is
public Bucket marketDataBucket() {
Cluster cluster = couchbaseCluster();
Bucket bucket = cluster.openBucket("MyBucket");
return bucket;
}
public CouchbaseEnvironment couchbaseEnvironment() {
return DefaultCouchbaseEnvironment.builder().build();
}
public Cluster couchbaseCluster() {
return CouchbaseCluster.create(couchbaseEnvironment(), "couchbase://xxx-yyy-zzz")
.authenticate("test", "test");
}
Code with SSL
public Bucket marketDataBucket() {
Cluster cluster = couchbaseCluster();
Bucket bucket = cluster.openBucket("MyBucket");
return bucket;
}
public CouchbaseEnvironment couchbaseEnvironment() {
return DefaultCouchbaseEnvironment.builder()
.sslEnabled(true)
.sslKeystoreFile("C:/Dev/certificate/cert.pfx")
.sslKeystorePassword("Password")
.build();
}
public Cluster couchbaseCluster() {
return CouchbaseCluster.create(couchbaseEnvironment(), "couchbase://xxx-yyy-zzz");
}
I also tried next code
public Bucket marketDataBucket() {
Cluster cluster = couchbaseCluster();
Bucket bucket = cluster.openBucket("MyBucket");
return bucket;
}
public CouchbaseEnvironment couchbaseEnvironment() {
return DefaultCouchbaseEnvironment.builder()
.sslEnabled(true)
.certAuthEnabled(true)
.sslKeystoreFile("C:/Dev/certificate/cert.pfx")
.sslKeystorePassword("Password")
.build();
}
public Cluster couchbaseCluster() {
return CouchbaseCluster.create(couchbaseEnvironment(), "couchbase://xxx-yyy-zzz").authenticate(CertAuthenticator.INSTANCE);
}
However, situation is the same.
I also create test_cert.pfx like this
Couchbase > Security > Root certificate
Copied the certificate and added to my keystore .
I used in my code instead of cert.pfx but I have the same issue
ConfigurationException: Could not open bucket.
I could not find some examples Couchbase Server 6.6 to check what I did wrongly.
Maybe somebody know how to fix my issue?