Getting error while building simple maven based java application with couchbase

Hi Every one,

I am new to couchbase and was trying to use hello world application with java sdk for couchbase .

I have added dependency in pom.xml


source code :slight_smile:


 * Hello world!
public class App 
    public static void main( String[] args )
    	// Create a cluster reference
    /*	CouchbaseCluster cluster = CouchbaseCluster.create("");

    	// Connect to the bucket and open it
    	Bucket bucket = cluster.openBucket("default");

    	// Create a JSON document and store it with the ID "helloworld"
    	JsonObject content = JsonObject.create().put("hello", "world");
    	JsonDocument inserted = bucket.upsert(JsonDocument.create("helloworld", content));

    	// Read the document and print the "hello" field
    	JsonDocument found = bucket.get("helloworld");
    	System.out.println("Couchbase is the best database in the " + found.content().getString("hello"));

    	// Close all buckets and disconnect
    	cluster.disconnect(); */
    	Cluster cluster = CouchbaseCluster.create("localhost");
        Bucket bucket = cluster.openBucket("default");

        // Create a JSON Document
        JsonObject arthur = JsonObject.create()
            .put("name", "Arthur")
            .put("email", "")
            .put("interests", JsonArray.from("Holy Grail", "African Swallows"));

        // Store the Document
        bucket.upsert(JsonDocument.create("u:king_arthur", arthur));

        // Load the Document and print it
        // Prints Content and Metadata of the stored Document

        // Create a N1QL Primary Index (but ignore if it exists)
        bucket.bucketManager().createN1qlPrimaryIndex(true, false);

        // Perform a N1QL Query
        N1qlQueryResult result = bucket.query(
            N1qlQuery.parameterized("SELECT name FROM default WHERE $1 IN interests",
            JsonArray.from("African Swallows"))

        // Print each found Row
        for (N1qlQueryRow row : result) {
            // Prints {"name":"Arthur"}
    	//System.out.println( "Hello World!" );

while running i am getting below error :

Exception in thread "main" java.lang.NoClassDefFoundError: com/couchbase/client/
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
        at java.lang.Class.privateGetMethodRecursive(Unknown Source)
        at java.lang.Class.getMethod0(Unknown Source)
        at java.lang.Class.getMethod(Unknown Source)
        at sun.launcher.LauncherHelper.validateMainClass(Unknown Source)
        at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException:
        at$ Source)
        at$ Source)
        at Method)
        at Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 7 more

Looks like your classpath is still wrong, there must be something misconfigured when running the app. The Cluster interface for sure is part of java-client.