Couchbase 1.3 Junit


#1

I am trying to connect to a couchbase server located in different machine through JUnit. I am able to hit the Admin Console URL from my machine. But JUnit does not work. It gets timed out. Please help.

@org.junit.Test
public void insert()
{

	List<URI> uris = new LinkedList<URI>();
	uris.add(URI.create("http://wkhmrcouchfd01:8091/pools"));
	CouchbaseConnectionFactoryBuilder cfb = new CouchbaseConnectionFactoryBuilder();
	cfb.setOpTimeout(10000);
	CouchbaseClient client = null;
	try {
		CouchbaseConnectionFactory cf = cfb.buildCouchbaseConnection(uris, "default", "", "");
	   client = new CouchbaseClient((CouchbaseConnectionFactory) cf);
	   OperationFuture<Boolean> future = client.set("cbello", "Couchbase value is inserted successfully");
	  // future.get(1, TimeUnit.MINUTES);
	} catch (Throwable e) {
	  System.err.println("Error connecting to Couchbase: " + e.getMessage());
	} finally{
		client.shutdown();
	}

}


#2

Hi @shivayemula,

Note that the SDK also needs other ports open (11210 and 8092 in addition to 8091).
Can you make sure those are accessible from your box?
Also, if this doesn’t help, can you share the client side log to look at?


#3

Hi @daschl,
Thanks for the reply.
i could see following information while running the code:
INFO: CoreEnvironment: {sslEnabled=false, sslKeystoreFile=‘null’, sslKeystorePassword=‘null’, queryEnabled=false, queryPort=8093, bootstrapHttpEnabled=true, bootstrapCarrierEnabled=true, bootstrapHttpDirectPort=8091, bootstrapHttpSslPort=18091, bootstrapCarrierDirectPort=11210, bootstrapCarrierSslPort=11207, ioPoolSize=4, computationPoolSize=4, responseBufferSize=16384, requestBufferSize=16384, kvServiceEndpoints=1, viewServiceEndpoints=1, queryServiceEndpoints=1, ioPool=NioEventLoopGroup, coreScheduler=CoreScheduler, packageNameAndVersion=couchbase-java-client/2.0.1 (git: 2.0.1)}

I am not sure how to check if the specified ports are open?


#4

Okay so this is just one message, but if the attempt fails there should be much more in the logs.

Also, you can check with telnet for example telnet host 11210 or any other methods (not particularly related to the SDK itself). Note that if you send the full logs over, they should provide more direct clues of whats going on.