Timeout Exception on RepositoryOperationsMapping.mapEntity()


I am working on a spring boot application that requires 2 couchbase buckets. I have followed recent examples for implementing this in my app but I am getting timeout exceptions when the configureRepositoryOperationsMapping method in my CouchbaseConfig class executes baseMapping.mapEntity(…, …) on my second bucket. After the timeout exception the application continues to build and I see that the second bucket has connected, after which I can still query the bucket directly but calls to repository methods have empty returns. More perplexing is that sometimes the application starts up without any errors and everything works as expected.

Thanks in advance for your help!

Java version: 8
Spring boot version: 1.5.9
Spring data couchbase version: 2.2.0

Examples I’ve followed:

What can you tell us about the environment it’s running in? Are both buckets on a local cluster? If you’re running across a WAN (or WiFi and a WAN), you may need to adjust the bootstrap level timings.

I’m connecting to the buckets remotely across a WAN.

That’s just at development time, correct? If so, you might want to set the connect timeout higher with a property at development time and it should all be good when the app is co-located with the cluster.

Please note that we have timings and even some heuristics set up in the SDKs to work with LAN-like latencies/throughputs. Since that’s what we test to, that’s what we support. It’s all TCP at the end of the day so it may work in other environments with tunings adjusted, they’re just not ideal.

Correct, this would only be a remote connection during development. I’ve tried setting the connectTimeout to something really long like 60 seconds with the same results. I created an @Override couchbaseCluster() method with the base code from AbstractCouchbaseConfiguration and added a .connectTimeout(). Is there another way to set the connectTimeout?

Generally it’s better to do it with the builder or an external property define. Builder example would be:

        CouchbaseEnvironment env = DefaultCouchbaseEnvironment

Gotcha, yeah this is still giving the same error. The only workaround I’ve found is adding in Thread.sleep(1000L) on the line before the .mapEntity() call.