Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Couchbase Bucket authentication error

Using Couchbase 5.0 and its Java client 2.0.3, I have the following error.

Just following these instructions to open a bucket:

https://developer.couchbase.com/documentation/server/current/sdk/java/managing-connections.html

As explained, with a basic local configuration, it's just a matter of two lines of code:

Cluster cluster = CouchbaseCluster.create();
Bucket bucket = cluster.openBucket("hero");

That should open the localhost cluster (it actually does) and afterwards open a bucket called "hero", which actually exists in my Couchbase server.

Nevertheless, I keep getting the following error:

2017-11-08 00:40:25.546 ERROR 1077 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is com.couchbase.client.java.error.InvalidPasswordException: Passwords for bucket "hero" do not match.] with root cause

com.couchbase.client.java.error.InvalidPasswordException: Passwords for bucket "hero" do not match.
    at com.couchbase.client.java.CouchbaseAsyncCluster$1.call(CouchbaseAsyncCluster.java:156) ~[java-client-2.0.3.jar:2.0.3]
    at com.couchbase.client.java.CouchbaseAsyncCluster$1.call(CouchbaseAsyncCluster.java:146) ~[java-client-2.0.3.jar:2.0.3]
    at rx.internal.operators.OperatorOnErrorResumeNextViaFunction$1.onError(OperatorOnErrorResumeNextViaFunction.java:77) ~[rxjava-1.0.4.jar:1.0.4]
    at rx.internal.operators.OperatorMap$1.onError(OperatorMap.java:49) ~[rxjava-1.0.4.jar:1.0.4]
    at rx.internal.operators.NotificationLite.accept(NotificationLite.java:147) ~[rxjava-1.0.4.jar:1.0.4]
    at rx.internal.operators.OperatorObserveOn$ObserveOnSubscriber.pollQueue(OperatorObserveOn.java:177) ~[rxjava-1.0.4.jar:1.0.4]
    at rx.internal.operators.OperatorObserveOn$ObserveOnSubscriber.access$000(OperatorObserveOn.java:65) ~[rxjava-1.0.4.jar:1.0.4]
    at rx.internal.operators.OperatorObserveOn$ObserveOnSubscriber$2.call(OperatorObserveOn.java:153) ~[rxjava-1.0.4.jar:1.0.4]
    at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:47) ~[rxjava-1.0.4.jar:1.0.4]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[na:1.8.0_151]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_151]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) ~[na:1.8.0_151]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) ~[na:1.8.0_151]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[na:1.8.0_151]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[na:1.8.0_151]
    at java.lang.Thread.run(Thread.java:748) [na:1.8.0_151]

Somehow it's asking a password for the bucket. But there is no configuration of password at bucket levels in Couchbase.

Any idea anyone?

like image 653
ElPiter Avatar asked Dec 03 '22 12:12

ElPiter


1 Answers

In Couchbase Server 5.0, role-based access controls were introduced. You must now create a user with a name that matches the bucket name and use that user's password when opening the bucket. The user must have a role with access rights to the bucket.

Cluster cluster = CouchbaseCluster.create();
Bucket bucket = cluster.openBucket("hero", "password");

See this Couchbase forum post for more information: V5.0 - NEW Role-Based Authentication - Bucket Passwords, etc

SDK Users

  • Continue to use your current SDK versions to access buckets where there is a user, with proper permissions, with the same name as the bucket.
  • Upgrade to the latest SDK versions to access the newer Authentication and User Management functions that are now available.
like image 199
Jeff Kurtz Avatar answered Dec 11 '22 09:12

Jeff Kurtz