Rahul
Rahul

Reputation: 95

couchbase java Authentication Failure issue

I have created json document 'test' inside couchbase bucket 'SAMPLE' which is remote . URL for couchbase is http://testcouch.employee.com:8091/index.html -- IP is 124.10.0.2

UserName for couch: helloUser

Password for couch: helloUser++

Connection.java

static CouchbaseEnvironment couchbaseEnvironment = DefaultCouchbaseEnvironment.builder()
        .queryTimeout(10000)
        .build();

    static Cluster cluster = CouchbaseCluster.create(couchbaseEnvironment,"http://testcouch.employee.com");

    static Bucket bucket = cluster.openBucket("SAMPLE","helloUser++");

When trying to connect getting below error:

WARNING: [null][KeyValueEndpoint]: Could not connect to endpoint, retrying with delay 32 MILLISECONDS: com.couchbase.client.core.endpoint.kv.AuthenticationException: Authentication Failure at com.couchbase.client.core.endpoint.kv.KeyValueAuthHandler.checkIsAuthed(KeyValueAuthHandler.java:288) at com.couchbase.client.core.endpoint.kv.KeyValueAuthHandler.channelRead0(KeyValueAuthHandler.java:173)

Upvotes: 1

Views: 6009

Answers (2)

clunven
clunven

Reputation: 1695

I got the same error. When creating a bucket from the UI there is no option to define a "password" at bucket level (v community 5.0.0).

Instead I created a user and give him admin right on target bucket. In the menu pick Security and then on top righ "Add user"

Specified the password on the cluster object not in openBucket

Cluster cluster = CouchbaseCluster.create(couchbaseEnvironment,"http://testcouch.employee.com");
couchBaseCluster.authenticate("helloUser", "helloUser++");
Bucket bucket = cluster.openBucket("SAMPLE","");

Upvotes: 3

Jeff Kurtz
Jeff Kurtz

Reputation: 661

The password given to the cluster.openBucket call is the one you specified when you created the bucket.

It appears you're using the Couchbase Web Console password.

If you don't recall creating a bucket password, try eliminating the password from the call.

Upvotes: 1

Related Questions