After upgrade to server version 5 , Java client can't connect to bucket

After upgrade to community server version 5 , Java client (2.5.1) can’t connect to bucket
It’s seems like in the new version when create bucket no “Access Control” for password.

Trying : bucket = couchBaseCluster.openBucket(“bucketName”)
bucket = couchBaseCluster.openBucket(couchbaseBucket,“pass” );

  • after creating user with security tab with “Bucket Full Access[bucketName]”

com.couchbase.client.core.endpoint.kv.AuthenticationException: Authentication Failure
at com.couchbase.client.core.endpoint.kv.KeyValueAuthHandler.checkIsAuthed( [stormjar.jar:?]
at com.couchbase.client.core.endpoint.kv.KeyValueAuthHandler.channelRead0( [stormjar.jar:?]
at com.couchbase.client.core.endpoint.kv.KeyValueAuthHandler.channelRead0( [stormjar.jar:?]

Help needed .

1 Like

Hi Shaialkabetz,

Can you verify the username and password for the user you created exactly match the bucket name and password in your code?


I am seeing the same issue. I use the docker containers latest tag for development. As part of my itests they run against a docker container

docker-compose excerpt

    image: couchbase:4.6.3
      - "8091:8091"
      - "8092:8092"
      - "8093:8093"
      - "8094:8094"
      - "11210:11210"

fails (at time of writing latest = 5.0.0)

    image: couchbase
      - "8091:8091"
      - "8092:8092"
      - "8093:8093"
      - "8094:8094"
      - "11210:11210"

I use couchbase spring data and the Hopper-SR11 release train. This includes com.couchbase.client:java-client:2.2.8

Here is the debug log from the client when it fails.

11:48:30.465 [main] INFO  o.s.t.c.s.DefaultTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.test.context.web.ServletTestExecutionListener,,,, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener]
11:48:30.498 [main] INFO  o.s.t.c.s.DefaultTestContextBootstrapper - Could not instantiate TestExecutionListener [org.springframework.test.context.web.ServletTestExecutionListener]. Specify custom listener classes or make the default listener classes (and their required dependencies) available. Offending class: [javax/servlet/ServletContext]
11:48:30.499 [main] INFO  o.s.t.c.s.DefaultTestContextBootstrapper - Using TestExecutionListeners: [,,, org.springframework.test.context.transaction.TransactionalTestExecutionListener@9a7504c, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@2c039ac6]11:48:30.789 [main] INFO  o.s.c.s.GenericApplicationContext - Refreshing startup date [Fri Nov 03 11:48:30 PDT 2017]; root of context hierarchy
11:48:31.690 [main] DEBUG c.c.c.c.l.CouchbaseLoggerFactory - Using SLF4J as the default logging framework
11:48:31.696 [main] DEBUG c.c.c.d.i.n.u.i.l.InternalLoggerFactory - Using SLF4J as the default logging framework
11:48:31.719 [main] DEBUG c.c.c.d.i.n.c.MultithreadEventLoopGroup - -Dio.netty.eventLoopThreads: 16
11:48:31.737 [main] DEBUG c.c.c.d.i.n.u.i.PlatformDependent0 - java.nio.Buffer.address: available
11:48:31.737 [main] DEBUG c.c.c.d.i.n.u.i.PlatformDependent0 - sun.misc.Unsafe.theUnsafe: available
11:48:31.738 [main] DEBUG c.c.c.d.i.n.u.i.PlatformDependent0 - sun.misc.Unsafe.copyMemory: available
11:48:31.738 [main] DEBUG c.c.c.d.i.n.u.i.PlatformDependent0 - java.nio.Bits.unaligned: true
11:48:31.739 [main] DEBUG c.c.c.d.i.n.u.i.PlatformDependent - Java version: 8
11:48:31.739 [main] DEBUG c.c.c.d.i.n.u.i.PlatformDependent - -Dio.netty.noUnsafe: false
11:48:31.739 [main] DEBUG c.c.c.d.i.n.u.i.PlatformDependent - sun.misc.Unsafe: available
11:48:31.740 [main] DEBUG c.c.c.d.i.n.u.i.PlatformDependent - -Dio.netty.noJavassist: false
11:48:31.742 [main] DEBUG c.c.c.d.i.n.u.i.PlatformDependent - Javassist: unavailable
11:48:31.742 [main] DEBUG c.c.c.d.i.n.u.i.PlatformDependent - You don't have Javassist in your class path or you don't have enough permission to load dynamically generated classes.  Please check the configuration for better performance.
11:48:31.742 [main] DEBUG c.c.c.d.i.n.u.i.PlatformDependent - -Dio.netty.tmpdir: /var/folders/m2/fdrj431n7d17ry2z5j7pw83h0000gn/T (
11:48:31.742 [main] DEBUG c.c.c.d.i.n.u.i.PlatformDependent - -Dio.netty.bitMode: 64 (
11:48:31.742 [main] DEBUG c.c.c.d.i.n.u.i.PlatformDependent - -Dio.netty.noPreferDirect: false
11:48:31.763 [main] DEBUG - -Dio.netty.noKeySetOptimization: false
11:48:31.763 [main] DEBUG - -Dio.netty.selectorAutoRebuildThreshold: 512
11:48:31.843 [main] INFO  c.c.client.core.CouchbaseCore - CouchbaseEnvironment: {sslEnabled=false, sslKeystoreFile='null', sslKeystorePassword='null', queryEnabled=false, queryPort=8093, bootstrapHttpEnabled=true, bootstrapCarrierEnabled=true, bootstrapHttpDirectPort=8091, bootstrapHttpSslPort=18091, bootstrapCarrierDirectPort=11210, bootstrapCarrierSslPort=11207, ioPoolSize=8, computationPoolSize=8, responseBufferSize=16384, requestBufferSize=16384, kvServiceEndpoints=1, viewServiceEndpoints=1, queryServiceEndpoints=1, searchServiceEndpoints=1, ioPool=NioEventLoopGroup, coreScheduler=CoreScheduler, eventBus=DefaultEventBus, packageNameAndVersion=couchbase-java-client/2.2.8 (git: 2.2.8, core: 1.2.9), dcpEnabled=false, retryStrategy=BestEffort, maxRequestLifetime=75000, retryDelay=ExponentialDelay{growBy 1.0 MICROSECONDS, powers of 2; lower=100, upper=100000}, reconnectDelay=ExponentialDelay{growBy 1.0 MILLISECONDS, powers of 2; lower=32, upper=4096}, observeIntervalDelay=ExponentialDelay{growBy 1.0 MICROSECONDS, powers of 2; lower=10, upper=100000}, keepAliveInterval=30000, autoreleaseAfter=2000, bufferPoolingEnabled=true, tcpNodelayEnabled=true, mutationTokensEnabled=false, socketConnectTimeout=1000, dcpConnectionBufferSize=20971520, dcpConnectionBufferAckThreshold=0.2, dcpConnectionName=dcp/core-io, callbacksOnIoPool=false, queryTimeout=75000, viewTimeout=75000, kvTimeout=2500, connectTimeout=5000, disconnectTimeout=25000, dnsSrvEnabled=false}
11:48:36.888 [main] DEBUG c.c.client.core.CouchbaseCore - Diagnostics { marksweep.collectionCount=0, marksweep.collectionTime=0, scavenge.collectionCount=1, scavenge.collectionTime=14,
  heap.used=init = 268435456(262144K) used = 69425456(67798K) committed = 257425408(251392K) max = 3817865216(3728384K),,,,,
  offHeap.used=init = 2555904(2496K) used = 21899392(21386K) committed = 22478848(21952K) max = -1(-1K),
  runtime.spec=Oracle Corporation/Java Virtual Machine Specification: 1.8,
  runtime.sysProperties={gopherProxySet=false, awt.toolkit=sun.lwawt.macosx.LWCToolkit,, java.specification.version=1.8,, sun.cpu.isalist=, sun.jnu.encoding=UTF-8, java.class.path=/Applications/IntelliJ, java.vm.vendor=Oracle Corporation,, idea.test.cyclic.buffer.size=1048576, java.vendor.url=, user.timezone=America/Vancouver, OS X, java.vm.specification.version=1.8,,, sun.boot.library.path=/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib, -ideVersion5 -junit4 com.data_realm.product.checkout.repository.SpringCheckoutRepositoryITest,testFindOneByTenantIdAndSessionId, http.nonProxyHosts=local|*.local|169.254/16|*.169.254/16, sun.cpu.endian=little, user.home=/Users/aedwards, user.language=en, java.specification.vendor=Oracle Corporation, java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre, file.separator=/, line.separator=
, java.vm.specification.vendor=Oracle Corporation, Platform API Specification, java.awt.graphicsenv=sun.awt.CGraphicsEnvironment, sun.boot.class.path=/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/sunrsasign.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/classes, 64-Bit Tiered Compilers, ftp.nonProxyHosts=local|*.local|169.254/16|*.169.254/16, java.runtime.version=1.8.0_92-b14,, path.separator=:, os.version=10.13, java.endorsed.dirs=/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/endorsed, SE Runtime Environment, file.encoding=UTF-8,, HotSpot(TM) 64-Bit Server VM, java.vendor.url.bug=,, java.version=1.8.0_92, user.dir=/Users/aedwards/Documents/DataRealm/product/checkout/repository-itests, os.arch=x86_64, Virtual Machine Specification, java.awt.printerjob=sun.lwawt.macosx.CPrinterJob, sun.os.patch.level=unknown, java.library.path=/Users/aedwards/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:., mode, java.vendor=Oracle Corporation, java.vm.version=25.92-b14, java.ext.dirs=/Users/aedwards/Library/Java/Extensions:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/ext:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java,, java.class.version=52.0, socksNonProxyHosts=local|*.local|169.254/16|*.169.254/16},
  runtime.vm=Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM: 25.92-b14,
  sys.os.arch=x86_64, OS X,
11:48:36.939 [main] DEBUG c.c.c.c.config.ConfigurationProvider - Setting seed hosts to [localhost/]
11:48:36.954 [main] DEBUG c.c.client.core.RequestHandler - Got instructed to add Node localhost/
11:48:36.954 [main] DEBUG c.c.client.core.RequestHandler - Connecting Node localhost/
11:48:36.954 [main] DEBUG com.couchbase.client.core.node.Node - [localhost]: Got instructed to connect.
11:48:36.956 [main] DEBUG c.c.client.core.RequestHandler - Connect finished, registering for use.
11:48:36.957 [cb-computations-6] DEBUG c.c.client.core.RequestHandler - Got instructed to add Service CONFIG, to Node localhost/
11:48:36.958 [cb-computations-6] DEBUG com.couchbase.client.core.node.Node - [localhost]: Adding Service CONFIG
11:48:36.961 [cb-computations-6] DEBUG com.couchbase.client.core.node.Node - [localhost]: Adding Service CONFIG to registry and connecting it.
11:48:36.961 [cb-computations-6] DEBUG c.c.client.core.service.Service - [localhost][ConfigService]: Got instructed to connect.
11:48:36.985 [cb-core-3-2] DEBUG c.c.c.d.i.n.b.PooledByteBufAllocator - -Dio.netty.allocator.numHeapArenas: 16
11:48:36.985 [cb-core-3-2] DEBUG c.c.c.d.i.n.b.PooledByteBufAllocator - -Dio.netty.allocator.numDirectArenas: 16
11:48:36.985 [cb-core-3-2] DEBUG c.c.c.d.i.n.b.PooledByteBufAllocator - -Dio.netty.allocator.pageSize: 8192
11:48:36.985 [cb-core-3-2] DEBUG c.c.c.d.i.n.b.PooledByteBufAllocator - -Dio.netty.allocator.maxOrder: 11
11:48:36.985 [cb-core-3-2] DEBUG c.c.c.d.i.n.b.PooledByteBufAllocator - -Dio.netty.allocator.chunkSize: 16777216
11:48:36.985 [cb-core-3-2] DEBUG c.c.c.d.i.n.b.PooledByteBufAllocator - -Dio.netty.allocator.tinyCacheSize: 512
11:48:36.985 [cb-core-3-2] DEBUG c.c.c.d.i.n.b.PooledByteBufAllocator - -Dio.netty.allocator.smallCacheSize: 256
11:48:36.985 [cb-core-3-2] DEBUG c.c.c.d.i.n.b.PooledByteBufAllocator - -Dio.netty.allocator.normalCacheSize: 64
11:48:36.985 [cb-core-3-2] DEBUG c.c.c.d.i.n.b.PooledByteBufAllocator - -Dio.netty.allocator.maxCachedBufferCapacity: 32768
11:48:36.986 [cb-core-3-2] DEBUG c.c.c.d.i.n.b.PooledByteBufAllocator - -Dio.netty.allocator.cacheTrimInterval: 8192
11:48:36.998 [cb-core-3-2] DEBUG com.couchbase.client.core.node.Node - Disconnected (IDLE) from Node localhost/
11:48:37.027 [cb-core-3-2] DEBUG c.c.c.d.i.n.u.i.ThreadLocalRandom - -Dio.netty.initialSeedUniquifier: 0x0600dbbdc9b68c50 (took 7 ms)
11:48:37.048 [cb-core-3-2] DEBUG - -Dio.netty.allocator.type: unpooled
11:48:37.048 [cb-core-3-2] DEBUG - -Dio.netty.threadLocalDirectBufferSize: 65536
11:48:37.048 [cb-core-3-2] DEBUG - -Dio.netty.maxThreadLocalCharBufferSize: 16384
11:48:37.119 [cb-io-1-1] DEBUG c.c.c.d.i.n.buffer.AbstractByteBuf - true
11:48:37.121 [cb-io-1-1] DEBUG c.c.c.d.i.n.u.ResourceLeakDetector - simple
11:48:37.121 [cb-io-1-1] DEBUG c.c.c.d.i.n.u.ResourceLeakDetector - 4
11:48:37.149 [cb-io-1-1] DEBUG c.c.client.core.endpoint.Endpoint - [localhost/][ConfigEndpoint]: Connected Endpoint.
11:48:37.150 [cb-io-1-1] INFO  com.couchbase.client.core.node.Node - Connected to Node localhost
11:48:37.151 [cb-io-1-1] DEBUG com.couchbase.client.core.node.Node - Connected (CONNECTING) to Node localhost/
11:48:37.156 [cb-io-1-1] DEBUG - -Dio.netty.recycler.maxCapacity.default: 262144
11:48:37.194 [cb-io-1-1] DEBUG c.c.c.c.e.AbstractGenericHandler - [localhost/][ConfigEndpoint]: Channel Active.
11:48:37.204 [cb-io-1-1] WARN  c.c.c.c.e.ResponseStatusConverter - Unknown ResponseStatus with Protocol HTTP: 401
11:48:37.208 [cb-io-1-1] DEBUG c.c.client.core.endpoint.Endpoint - [localhost/][ConfigEndpoint]: Disconnected Endpoint.
11:48:37.208 [cb-io-1-1] INFO  com.couchbase.client.core.node.Node - Disconnected from Node localhost
11:48:37.209 [cb-io-1-1] DEBUG com.couchbase.client.core.node.Node - Disconnected (DISCONNECTING) from Node localhost/
11:48:37.212 [main] INFO  c.d.p.r.c.s.RepositoryConfiguration - Couchbase Bootstrap Failure (class null).  Retrying in 1000ms (24458 ms remaining)
11:48:37.216 [cb-io-1-1] DEBUG c.c.c.c.e.AbstractGenericHandler - [localhost/][ConfigEndpoint]: Channel Inactive.
11:48:37.216 [cb-io-1-1] DEBUG c.c.client.core.endpoint.Endpoint - [null][ConfigEndpoint]: Got notified from Channel as inactive.
11:48:38.216 [main] DEBUG c.c.client.core.RequestHandler - Node localhost/ already registered, skipping.
11:48:38.217 [cb-computations-1] DEBUG c.c.client.core.RequestHandler - Got instructed to add Service CONFIG, to Node localhost/
11:48:38.217 [cb-computations-1] DEBUG com.couchbase.client.core.node.Node - [localhost]: Adding Service CONFIG
11:48:38.217 [cb-computations-1] DEBUG com.couchbase.client.core.node.Node - [localhost]: Service CONFIG already added, skipping.
11:48:38.219 [cb-core-3-2] DEBUG com.couchbase.client.core.node.Node - Disconnected (IDLE) from Node localhost/
11:48:38.224 [cb-io-1-2] DEBUG c.c.client.core.endpoint.Endpoint - [localhost/][ConfigEndpoint]: Connected Endpoint.
11:48:38.224 [cb-io-1-2] INFO  com.couchbase.client.core.node.Node - Connected to Node localhost
11:48:38.224 [cb-io-1-2] DEBUG com.couchbase.client.core.node.Node - Connected (CONNECTING) to Node localhost/
11:48:38.234 [cb-io-1-2] DEBUG c.c.c.c.e.AbstractGenericHandler - [localhost/][ConfigEndpoint]: Channel Active.
11:48:38.235 [cb-io-1-2] WARN  c.c.c.c.e.ResponseStatusConverter - Unknown ResponseStatus with Protocol HTTP: 401
11:48:38.235 [cb-io-1-2] DEBUG c.c.client.core.endpoint.Endpoint - [localhost/][ConfigEndpoint]: Disconnected Endpoint.
11:48:38.235 [cb-io-1-2] INFO  com.couchbase.client.core.node.Node - Disconnected from Node localhost
11:48:38.235 [cb-io-1-2] DEBUG com.couchbase.client.core.node.Node - Disconnected (DISCONNECTING) from Node localhost/
11:48:38.236 [main] INFO  c.d.p.r.c.s.RepositoryConfiguration - Couchbase Bootstrap Failure (class null).  Retrying in 1000ms (23434 ms remaining)

And so on until some retry/timeout is reached

I am having the same exception. How did you solve this problem? I think Spring Data needs an update for CB 5.0.

Please read the docs. You can create a username the same as the bucket and set the password on that so the earlier SDK can auth.

Hi, Thanks for your reply.

My problem wasn’t related with CB. Spring Data versioning is too confusing. I found the right version and everything works fine now.

Any suggestions for deailing with this in test phase of build? We create/delete buckets in test setup/tear down and still have this error. Tried creating a user with full privileges that is named the same as the bucket we create during our tests still yields the same authentication exception as OP. Any help would be greatly appreciated. My head hurts from banging it against the wall so much :slight_smile:


It’s hard to say without knowing where the issue is occurring, but my guess is that you may need to pause a bit between configuring things and using them. Unfortunately, the Couchbase REST management interface acknowledges requests and then does them asynchronously, so test scaffolding like this needs to pause a bit.

To verify that, you may want to turn the log level up and see where things go wrong. If it’s something like opening a bucket milliseconds after the bucket/user are created, that might be why.

It’s a long known issue filed by yours truly. MB-8504, later closed as a duplicate of MB-11484.

K, thanks for the info, very much appreciate it. I guess probably the simplest solution would be to require a bucket to exist before test can run, hurts a bit to take the easy way out, but probably best solution for now.

thx again.

I found where the issue. I don’t know if there is a place for suggestions, but I’ve definitely got one to add if there is -

My problems happened when we upgraded to 5.0.1 server. During this time we also upgraded java client from 2.1.3 to 2.5.6. We have quite a bit of test coverage that has all been working well for a very long time. It appears that there was an innocuous, but for me, significant change, that is not truly reflected in the javadoc from
2.1.3 here:

to 2.5.6 here:

They both have the same signature, and say the same things for the return value, but instead of returning null when design document doesn’t exist, now a DesignDocumentDoesNotExistException (a runtime exception!) is being thrown. We use Guice for dependency injection, so tracking down this runtime exception was quite tricky as it was very difficult to determine in test run where it was originating.

Maybe I’m too old or we have a unique setup but it seems not so great to keep a method signature the same, but unexecpectedly throw a runtime exception where previously method was returning null without really mentioning it. That’s the kind of thing I might deprecate a method for, or at least call out more explictly. (I"m awre that in the javadoc if you read the description it notes the runtime exception, but it’s not marked in @throws where one might expect that sort of thing.

Anyways, if more appropriate place for this is elsewhere, let me know.

This change was introduced in 2.4.0, sorry that it broke something for you - the upside is that the API is now more consistent ( The javadoc shows both exception in the list and has the null thing in the docs, so you are right that it is inconsistent. I’ll open a ticket to track the doc fix.