NoClassDefFoundError on CoreEnvironment

Hi simonbasle,

I am new to couchbase and am facing some issue like below

Couchbase server is local inmy system installed .

public class CouchBaseConnector {

public static void main(String[] args) {
	
	
	
	try {
		System.out.println("Create connection");
		Cluster cluster = CouchbaseCluster.create();
		System.out.println("Try to openBucket");
		Bucket bucket = cluster.openBucket("beer-sample");
		System.out.println("disconnect");
		cluster.disconnect();
	}
	catch (Exception e) {
		e.printStackTrace();
	}
}

}

am getting error like

Create connection
Exception in thread “main” java.lang.NoClassDefFoundError: com/couchbase/client/core/env/CoreEnvironment
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:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at com.ciber.hilton.CouchBaseConnector.main(CouchBaseConnector.java:18)
Caused by: java.lang.ClassNotFoundException: com.couchbase.client.core.env.CoreEnvironment
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
… 13 more

Please reply me ASAP

@Sagarika moved to a new topic (as the old one is 10 month old and not the same error)

Did you use a dependency manager like Maven or Gradle to build your project? It looks like you are missing couchbase-jvm-core, which is a dependency of the couchbase-java-client

Thanks for immediate response.

No am not using maven, its stand alone java program where i have to fetch the data from couchbase server.
For that , first i have to connect Couchbase server using below line

Cluster cluster = CouchbaseCluster.create();

but am getting error in the above line code .

Or pls suggest me how to connect Couchbase server using java where couchbase server is installed locally(local host).

Yous response will be really appreciated .

The SDK has dependencies, you should at least make sure you have all of them!

There should be a zip file downloadable from the release page of the sdk do documentation (don’t have the link handy, on my phone).

But my recommendation is save yourself a world of trouble and use maven :wink:

edit: @Sagarika the dowload and reference page is here for 2.2.x versions (current latest).