SSL Setup in Couchbase

I have signed SSL certificates installed on the couchbase server , i can access server at port 18091.

Im trying to connect from java-client with SSL enabled however im not able to.

I have generated the my.keystore file referring the below document :

Here is my code :

try {
        //this tunes the SDK (to customize connection timeout)
       
		CouchbaseEnvironment env = DefaultCouchbaseEnvironment
                //.connectTimeout(10000)//10000ms = 10s, default is 5s
               .builder()
               .sslEnabled(true)
                .sslKeystoreFile("/Users/myname/.keystore")
                .sslKeystorePassword("storepass”)
                .build();
       
        System.out.println("Create connection");
      
        
       Cluster cluster = CouchbaseCluster.create(env,”XX.XX.XX.XX”);
        
      
       //cluster.authenticate("test", "test123");
        System.out.println("Try to openBucket");
        Bucket bucket = cluster.openBucket("test","test123"); 
      
       System.out.println("::::");
 
  
       JsonDocument query = bucket.get("test");
    		   //query(select("*").from("test");

       System.out.println(query);
       
}

below is my error

com.couchbase.client.core.config.ConfigurationException: Could not open bucket.

at com.couchbase.client.core.config.DefaultConfigurationProvider$6.call(DefaultConfigurationProvider.java:304)

at com.couchbase.client.core.config.DefaultConfigurationProvider$6.call(DefaultConfigurationProvider.java:301)

at rx.internal.operators.OperatorOnErrorResumeNextViaFunction$4.onError(OperatorOnErrorResumeNextViaFunction.java:140)

at rx.internal.operators.OnSubscribeDoOnEach$DoOnEachSubscriber.onError(OnSubscribeDoOnEach.java:87)

at rx.internal.operators.OnSubscribeDoOnEach$DoOnEachSubscriber.onError(OnSubscribeDoOnEach.java:87)

at rx.internal.operators.OnSubscribeMap$MapSubscriber.onError(OnSubscribeMap.java:88)

at rx.internal.operators.OnSubscribeDoOnEach$DoOnEachSubscriber.onError(OnSubscribeDoOnEach.java:87)

at rx.internal.operators.OperatorTake$1.onError(OperatorTake.java:66)

at rx.internal.operators.OperatorMerge$MergeSubscriber.reportError(OperatorMerge.java:266)

at rx.internal.operators.OperatorMerge$MergeSubscriber.emitLoop(OperatorMerge.java:658)

at rx.internal.operators.OperatorMerge$MergeSubscriber.emit(OperatorMerge.java:568)

at rx.internal.operators.OperatorMerge$InnerSubscriber.onError(OperatorMerge.java:855)

at rx.internal.operators.OperatorOnErrorResumeNextViaFunction$4$1.onError(OperatorOnErrorResumeNextViaFunction.java:122)

at rx.internal.operators.OnSubscribeMap$MapSubscriber.onError(OnSubscribeMap.java:88)

at rx.internal.operators.OperatorMerge$MergeSubscriber.reportError(OperatorMerge.java:266)

at rx.internal.operators.OperatorMerge$MergeSubscriber.checkTerminate(OperatorMerge.java:818)

at rx.internal.operators.OperatorMerge$MergeSubscriber.emitLoop(OperatorMerge.java:579)

at rx.internal.operators.OperatorMerge$MergeSubscriber.emit(OperatorMerge.java:568)

at rx.internal.operators.OperatorMerge$InnerSubscriber.onError(OperatorMerge.java:855)

at rx.internal.operators.OnSubscribeMap$MapSubscriber.onError(OnSubscribeMap.java:88)

at rx.internal.operators.OperatorMerge$MergeSubscriber.reportError(OperatorMerge.java:266)

at rx.internal.operators.OperatorMerge$MergeSubscriber.checkTerminate(OperatorMerge.java:818)

at rx.internal.operators.OperatorMerge$MergeSubscriber.emitLoop(OperatorMerge.java:579)

at rx.internal.operators.OperatorMerge$MergeSubscriber.emit(OperatorMerge.java:568)

at rx.internal.operators.OperatorMerge$MergeSubscriber.onError(OperatorMerge.java:276)

at rx.internal.operators.OnSubscribeMap$MapSubscriber.onError(OnSubscribeMap.java:88)

at rx.subjects.SubjectSubscriptionManager$SubjectObserver.onError(SubjectSubscriptionManager.java:227)

at rx.subjects.AsyncSubject.onError(AsyncSubject.java:116)

at com.couchbase.client.core.utils.Observables$1.call(Observables.java:52)

at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)

at java.util.concurrent.FutureTask.run(FutureTask.java:266)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

at java.lang.Thread.run(Thread.java:748)

Caused by: com.couchbase.client.core.RequestCancelledException: Request cancelled in-flight.

at com.couchbase.client.core.endpoint.AbstractGenericHandler.handleOutstandingOperations(AbstractGenericHandler.java:686)

at com.couchbase.client.core.endpoint.AbstractGenericHandler.handlerRemoved(AbstractGenericHandler.java:667)

at com.couchbase.client.core.endpoint.config.ConfigHandler.handlerRemoved(ConfigHandler.java:343)

at com.couchbase.client.deps.io.netty.channel.DefaultChannelPipeline.callHandlerRemoved0(DefaultChannelPipeline.java:626)

at com.couchbase.client.deps.io.netty.channel.DefaultChannelPipeline.destroyDown(DefaultChannelPipeline.java:878)

at com.couchbase.client.deps.io.netty.channel.DefaultChannelPipeline.destroyUp(DefaultChannelPipeline.java:844)

at com.couchbase.client.deps.io.netty.channel.DefaultChannelPipeline.destroy(DefaultChannelPipeline.java:836)

at com.couchbase.client.deps.io.netty.channel.DefaultChannelPipeline.access$700(DefaultChannelPipeline.java:44)

at com.couchbase.client.deps.io.netty.channel.DefaultChannelPipeline$HeadContext.channelUnregistered(DefaultChannelPipeline.java:1286)

at com.couchbase.client.deps.io.netty.channel.AbstractChannelHandlerContext.invokeChannelUnregistered(AbstractChannelHandlerContext.java:176)

at com.couchbase.client.deps.io.netty.channel.AbstractChannelHandlerContext.invokeChannelUnregistered(AbstractChannelHandlerContext.java:162)

at com.couchbase.client.deps.io.netty.channel.DefaultChannelPipeline.fireChannelUnregistered(DefaultChannelPipeline.java:821)

at com.couchbase.client.deps.io.netty.channel.AbstractChannel$AbstractUnsafe$8.run(AbstractChannel.java:776)

at com.couchbase.client.deps.io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:399)

at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:464)

at com.couchbase.client.deps.io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:131)

at com.couchbase.client.deps.io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)

… 1 more

Please note : i’m able to connect and retrieve from SSLEnabled parameter set to false in the CB env.

TIA , Looking forward for some help !!

What is the Couchbase Server version? What is the SDK version?
And what SSL certificate did you add to the keystore? Where did you copy it from ?

Enterprise Edition 6.0.1
SDK version 2.7.4
Couchbase > Security > Root certificate
Copied the certificate and added to my keystore .

I’m not able to reproduce this issue.
In this situation, you could possibly get this exception if

  1. The keystore password used is wrong
  2. The keystore path is wrong.

Can you please make sure that the keystore file supplied in the sslKeystoreFile is correct and that the password is correct?