Error connecting using CouchbaseClient

#1

Im trying to connect to CouchbaseClient but failed with the exception below.

Please help. Couldnt find a way to let it work.

Thanks.

Exception in thread “main” java.lang.IllegalAccessError: class com.couchbase.client.vbucket.provider.GetConfigOperationImpl cannot access its superclass net.spy.memcached.protocol.binary.OperationImpl
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:455)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:367)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at com.couchbase.client.vbucket.provider.BucketConfigurationProvider$3.newOp(BucketConfigurationProvider.java:303)
at net.spy.memcached.MemcachedConnection.broadcastOperation(MemcachedConnection.java:732)
at net.spy.memcached.MemcachedConnection.broadcastOperation(MemcachedConnection.java:722)
at com.couchbase.client.vbucket.provider.BucketConfigurationProvider.getConfigsFromBinaryConnection(BucketConfigurationProvider.java:299)
at com.couchbase.client.vbucket.provider.BucketConfigurationProvider.tryBinaryBootstrapForNode(BucketConfigurationProvider.java:238)
at com.couchbase.client.vbucket.provider.BucketConfigurationProvider.bootstrapBinary(BucketConfigurationProvider.java:158)
at com.couchbase.client.vbucket.provider.BucketConfigurationProvider.bootstrap(BucketConfigurationProvider.java:121)
at com.couchbase.client.vbucket.provider.BucketConfigurationProvider.getConfig(BucketConfigurationProvider.java:371)
at com.couchbase.client.CouchbaseConnectionFactory.getVBucketConfig(CouchbaseConnectionFactory.java:316)
at com.couchbase.client.CouchbaseClient.(CouchbaseClient.java:258)
at com.couchbase.client.CouchbaseClient.(CouchbaseClient.java:194)
at com.adxpose.test.CouchbaseClientTest.main(CouchbaseClientTest.java:40)
Exception in thread “Thread-2” java.lang.NullPointerException
at net.spy.memcached.protocol.binary.SASLAuthOperationImpl.buildResponse(SASLAuthOperationImpl.java:50)
at net.spy.memcached.protocol.binary.SASLBaseOperationImpl.initialize(SASLBaseOperationImpl.java:67)
at net.spy.memcached.MemcachedConnection.insertOperation(MemcachedConnection.java:686)
at net.spy.memcached.auth.AuthThread.run(AuthThread.java:87)

curl http://qaserver.office.qa.com:8091/pools/default/bucketsStreaming/couchbaseT
{“name”:“couchbaseT”,“bucketType”:“membase”,“authType”:“none”,“saslPassword”:"",“proxyPort”:29901,“replicaIndex”:true,“uri”:"/pools/default/buckets/couchbaseT?bucket_uuid=cea3fb0f5efe290966da5e80a52d3842",“streamingUri”:"/pools/default/bucketsStreaming/couchbaseT?bucket_uuid=cea3fb0f5efe290966da5e80a52d3842",“localRandomKeyUri”:"/pools/default/buckets/couchbaseT/localRandomKey",“controllers”:{“flush”:"/pools/default/buckets/couchbaseT/controller/doFlush",“compactAll”:"/pools/default/buckets/couchbaseT/controller/compactBucket",“compactDB”:"/pools/default/buckets/default/controller/compactDatabases",“purgeDeletes”:"/pools/default/buckets/couchbaseT/controller/unsafePurgeBucket",“startRecovery”:"/pools/default/buckets/couchbaseT/controller/startRecovery"},“nodes”:[{“couchApiBase”:“http://10.101.54.41:8092/couchbaseT%2Bcea3fb0f5efe290966da5e80a52d3842",“replication”:1,“clusterMembership”:“active”,“recoveryType”:“none”,“status”:“healthy”,“otpNode”:“ns_1@10.101.54.41”,“hostname”:“10.101.54.41:8091”,“clusterCompatibility”:196608,“version”:“3.0.1-1444-rel-community”,“os”:“x86_64-unknown-linux-gnu”,“ports”:{“proxy”:11211,“direct”:11210}},{“couchApiBase”:“http://10.101.54.45:8092/couchbaseT%2Bcea3fb0f5efe290966da5e80a52d3842”,“replication”:1,“clusterMembership”:“active”,“recoveryType”:“none”,“status”:“healthy”,“otpNode”:“ns_1@10.101.54.45”,“hostname”:“10.101.54.45:8091”,“clusterCompatibility”:196608,“version”:“3.0.1-1444-rel-community”,“os”:“x86_64-unknown-linux-gnu”,“ports”:{“proxy”:11211,“direct”:11210}},{“couchApiBase”:“http://10.101.54.44:8092/couchbaseT%2Bcea3fb0f5efe290966da5e80a52d3842”,“replication”:1,“clusterMembership”:“active”,“recoveryType”:“none”,“status”:“healthy”,“otpNode”:“ns_1@10.101.54.44”,“hostname”:“10.101.54.44:8091”,“clusterCompatibility”:196608,“version”:“3.0.1-1444-rel-community”,“os”:“x86_64-unknown-linux-gnu”,“ports”:{“proxy”:11211,“direct”:11210}},{“couchApiBase”:“http://10.101.54.43:8092/couchbaseT%2Bcea3fb0f5efe290966da5e80a52d3842”,“replication”:1,“clusterMembership”:“active”,“recoveryType”:“none”,“status”:“healthy”,“otpNode”:“ns_1@10.101.54.43”,“hostname”:“10.101.54.43:8091”,“clusterCompatibility”:196608,“version”:“3.0.1-1444-rel-community”,“os”:“x86_64-unknown-linux-gnu”,“ports”:{“proxy”:11211,“direct”:11210}},{“couchApiBase”:“http://10.101.54.42:8092/couchbaseT%2Bcea3fb0f5efe290966da5e80a52d3842”,“replication”:1,“clusterMembership”:“active”,“recoveryType”:“none”,“status”:“healthy”,“otpNode”:“ns_1@10.101.54.42”,“thisNode”:true,“hostname”:“10.101.54.42:8091”,“clusterCompatibility”:196608,“version”:“3.0.1-1444-rel-community”,“os”:“x86_64-unknown-linux-gnu”,“ports”:{“proxy”:11211,“direct”:11210}}],“stats”:{“uri”:"/pools/default/buckets/couchbaseT/stats",“directoryURI”:"/pools/default/buckets/couchbaseT/statsDirectory",“nodeStatsListURI”:"/pools/default/buckets/couchbaseT/nodes"},“ddocs”:{“uri”:"/pools/default/buckets/couchbaseT/ddocs"},“nodeLocator”:“vbucket”,“fastWarmupSettings”:false,“autoCompactionSettings”:false,“uuid”:“cea3fb0f5efe290966da5e80a52d3842”,“vBucketServerMap”:{“hashAlgorithm”:“CRC”,“numReplicas”:1,“serverList”:[“10.101.54.41:11210”,“10.101.54.42:11210”,“10.101.54.43:11210”,“10.101.54.44:11210”,“10.101.54.45:11210”],"vBucketMap”:[[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[4,2],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[0,3],[3,4],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[0,3],[0,3],[0,3],[0,3],[0,3],[0,3],[0,3],[0,3],[0,3],[0,3],[0,3],[0,3],[0,3],[0,3],[0,3],[0,3],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,2],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[2,0],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,0],[2,0],[2,0],[2,0],[2,0],[2,0],[2,0],[2,0],[2,0],[2,0],[2,0],[2,0],[2,0],[2,0],[2,0],[4,1],[0,2],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[0,2],[0,2],[0,2],[0,2],[0,2],[0,2],[0,2],[0,2],[0,2],[0,2],[0,2],[0,2],[0,2],[0,2],[0,2],[0,2],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[1,0],[1,0],[0,4],[0,1],[0,2],[0,2],[0,2],[0,2],[0,2],[0,2],[0,2],[0,2],[0,2],[0,2],[0,2],[0,2],[0,2],[0,2],[0,2],[0,2],[2,4],[1,4],[0,2],[0,2],[0,2],[0,2],[0,2],[0,2],[0,2],[0,2],[0,2],[0,2],[0,2],[0,2],[0,2],[0,2],[0,2],[0,2],[0,3],[0,3],[0,3],[0,3],[0,3],[0,3],[0,3],[0,3],[0,3],[0,3],[0,3],[0,3],[0,3],[0,3],[0,3],[0,3],[0,3],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[2,4],[0,3],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[0,2],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,3],[1,0],[1,0],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,3],[1,3],[1,4],[1,4],[1,4],[1,4],[1,4],[1,4],[1,4],[1,4],[1,4],[1,4],[1,4],[1,4],[1,4],[1,4],[1,4],[2,3],[2,3],[1,2],[1,2],[1,2],[1,2],[2,3],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,4],[2,4],[1,3],[1,3],[1,3],[1,3],[1,3],[1,3],[1,3],[1,3],[1,3],[1,3],[1,3],[1,3],[1,3],[2,4],[2,4],[4,0],[4,0],[0,1],[1,3],[1,3],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[1,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[0,4],[0,4],[0,4],[0,4],[0,4],[0,4],[0,4],[0,4],[0,4],[0,4],[0,4],[0,4],[0,4],[0,4],[0,4],[0,4],[0,4],[1,3],[1,3],[1,3],[1,3],[1,3],[1,3],[1,3],[1,3],[1,3],[1,3],[1,3],[1,3],[1,3],[4,0],[4,0],[4,0],[4,0],[1,3],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[0,3],[0,4],[0,4],[0,4],[0,4],[0,4],[0,4],[0,4],[0,4],[0,4],[0,4],[0,4],[0,4],[0,4],[0,4],[0,4],[0,4],[1,3],[1,3],[0,4],[0,4],[0,4],[0,1],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[2,3],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[2,3],[0,4],[0,4],[0,4],[0,4],[0,4],[0,4],[0,4],[0,4],[0,4],[0,4],[0,4],[0,4],[0,4],[0,4],[3,0],[3,0],[3,0],[1,2],[1,2],[2,0],[2,0],[2,0],[2,0],[2,0],[2,0],[2,0],[2,0],[2,0],[2,0],[2,0],[2,0],[2,0],[2,0],[3,0],[3,0],[3,0],[3,0],[3,0],[3,0],[3,0],[3,0],[3,0],[3,0],[3,0],[3,0],[3,0],[3,0],[0,2],[2,0],[2,0],[2,0],[2,0],[2,0],[2,0],[2,0],[2,0],[2,0],[2,0],[2,0],[2,0],[2,0],[2,0],[2,0],[2,0],[0,3],[0,3],[1,3],[2,

public static void main(String args[]) {
// Set the URIs and get a client

	try {
	
		Object value = "Hello World";
		ArrayList<URI> uris = new ArrayList<URI>();
		uris.add(URI.create("http://qaserver.office.comscore.com:8091/pools/default/bucketsStreaming/couchbaseT"));

		CouchbaseClient c = new CouchbaseClient(uris, "couchbaseT", "");

		 c.set("couchbasetestkey", 0, "Hello World");
	     System.out.println("GET KEY= "+c.get("couchbasetestkey"));
	     c.delete("couchbasetestkey");
	     System.out.println("DELETEd KEY= "+c.get("couchbasetestkey"));
	     
	} catch (Exception e) {
		System.err.println("Error connecting to Couchbase: "
				+ e.getMessage());
		System.exit(0);
	}
}
#2

For the specific error you’re getting, it seems like something is off in the way the client and it’s dependencies have been installed. That said…

You’re using a client that is end of life from what I can see above. The current release as of this writing is 2.3.1 and the docs cover how to set it up and do a simple get. See the line with bucket.get() in that code sample.