Hi Team, I am new in Couchbase a nd trying simple application to retrieve the document from Couchbase
package couchbase.Connect;
import com.couchbase.client.java.Bucket;
import com.couchbase.client.java.Cluster;
import com.couchbase.client.java.CouchbaseCluster;
import rx.functions.Func1;
public class CouchbaseConnect {
private static String Bucketname = "tr-dev";
private static String bucketPassword = "23rates123$";
public static void main(String[] args) {
System.out.print("hello world");
Bucket buck = loginBucket();
System.out.print(buck.get("/english/flying"));
}
public static Bucket loginBucket() {
Cluster cluster = CouchbaseCluster.create("couchbase://10.107.13.106,10.107.10.172");
return cluster.openBucket(Bucketname, bucketPassword);
}
}
I am getting below error
hello worldException in thread “main” java.lang.NoClassDefFoundError: com/couchbase/client/core/env/CoreEnvironment
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(Unknown Source)
at java.base/java.security.SecureClassLoader.defineClass(Unknown Source)
at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(Unknown Source)
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(Unknown Source)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(Unknown Source)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
at couchbase.Connect.CouchbaseConnect.loginBucket(CouchbaseConnect.java:21)
at couchbase.Connect.CouchbaseConnect.main(CouchbaseConnect.java:16)
Caused by: java.lang.ClassNotFoundException: com.couchbase.client.core.env.CoreEnvironment
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
… 11 more
I have search for this error , in one of the post they suggest to use latest Java Couchbase SDK but I am using 2.4.1 Java-Client.
Please help , I am missing any Reference JAR or any file.