Couchbase Bucket身份验证错误

时间:2017-11-07 23:59:07

标签: java sdk nosql couchbase bucket

使用Couchbase 5.0及其Java客户端2.0.3,我有以下错误。

按照这些说明打开一个水桶:

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

如上所述,使用基本的本地配置,只需要两行代码:

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

那应该打开localhost集群(实际上是这样)然后打开一个名为“hero”的存储桶,它实际存在于我的Couchbase服务器中。

尽管如此,我仍然收到以下错误:

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]

不知怎的,它正在询问存储桶的密码。但是在Couchbase中没有桶级别的密码配置。

任何人都知道吗?

1 个答案:

答案 0 :(得分:15)

在Couchbase Server 5.0中,引入了基于角色的访问控制。您现在必须创建一个名称与存储桶名称匹配的用户,并在打开存储桶时使用该用户的密码。用户必须具有对存储桶具有访问权限的角色。

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

有关详细信息,请参阅此Couchbase论坛帖子:V5.0 - NEW Role-Based Authentication - Bucket Passwords, etc

  

SDK用户

     
      
  • 继续使用您当前的SDK版本来访问存在具有适当权限且与存储桶同名的用户的存储桶。
  •   
  • 升级到最新的SDK版本,以访问现在可用的较新的身份验证和用户管理功能。
  •