When trying to connect(new CouchbaseClient()) using java I’m getting “java.nio.channels.UnresolvedAddressException”.
package com.couchbase.examples;import com.couchbase.client.CouchbaseClient;
import java.net.URI;
import java.util.ArrayList;
public class App {
public static void main(String[] args) throws Exception {
ArrayList nodes = new ArrayList();
// Add one or more nodes of your cluster (exchange the IP with yours)
nodes.add(URI.create("http://192.168.8.120:8091/pools"));
// Try to connect to the client
CouchbaseClient client = null;
try {
client = new CouchbaseClient(nodes, "default", "");
} catch (Exception e) {
System.err.println("Error connecting to Couchbase: "
+ e.getMessage());
e.printStackTrace();
System.exit(1);
}
// Set your first document with a key of "hello" and a value of
// "couchbase!"
client.set("hello", "couchbase!").get();
// Return the result and cast it to string
String result = (String) client.get("hello");
System.out.println(result);
// Shutdown the client
client.shutdown();
}
}
“http://192.168.8.120:8091/pools/” access the following result
{"pools":[{"name":"default","uri":"/pools/default?uuid=3414701f8948f135420a2660f3faee28","streamingUri":"/poolsStreaming/default?uuid=3414701f8948f135420a2660f3faee28"}],"isAdminCreds":false,"settings":{"maxParallelIndexers":"/settings/maxParallelIndexers?uuid=3414701f8948f135420a2660f3faee28","viewUpdateDaemon":"/settings/viewUpdateDaemon?uuid=3414701f8948f135420a2660f3faee28"},"uuid":"3414701f8948f135420a2660f3faee28","implementationVersion":"2.1.1-764-rel-community","componentsVersion":{"public_key":"0.13","lhttpc":"1.3.0","ale":"8ca6d2a","os_mon":"2.2.7","couch_set_view":"1.2.0a-1969a70-git","compiler":"4.7.5","inets":"5.7.1","couch":"1.2.0a-1969a70-git","mapreduce":"1.0.0","couch_index_merger":"1.2.0a-1969a70-git","kernel":"2.14.5","crypto":"2.0.4","ssl":"4.1.6","sasl":"2.1.10","couch_view_parser":"1.0.0","ns_server":"2.1.1-764-rel-community","mochiweb":"2.4.2","syntax_tools":"1.6.7.1","xmerl":"1.2.10","oauth":"","stdlib":"1.17.5"}}Am I doing anything wrong? Thanks.