Hello,
I’m having serious issues connecting to our Couchbase Server (4.5) with the Java SDK.
The story so far: I’m running couchbase inside of docker. I’ve opened up the couchbase ports like this:
port mappings
- “8091:8091”
- “8092:8092”
- “8094:8093” <- notice the skip of 8093, as it’s currently used for something else and I can’t change that
- “8095:8094”
- “11210:11210”
I’m trying to connect via the Java SDK (using version 2.3.6 as it’s mentioned in the documentation) inside of a Spring Boot Application.
The connection itself works fine with
java connection build up
Cluster cluster = CouchbaseCluster.create(config.getHost());
Bucket bucket = cluster.openBucket("default","");
I can successfully load documents via bucket.get(“id”), which works via the 11210 port I assume. But the sdk fails to be able to even run the simplest query. bucket.query(N1qlQuery.simple(select("*").fromCurrentBucket())) fails with
stacktrace
com.couchbase.client.core.RequestCancelledException: Request cancelled in-flight.
at com.couchbase.client.core.endpoint.AbstractGenericHandler.handleOutstandingOperations(AbstractGenericHandler.java:502)
at com.couchbase.client.core.endpoint.AbstractGenericHandler.exceptionCaught(AbstractGenericHandler.java:465)
at com.couchbase.client.deps.io.netty.channel.AbstractChannelHandlerContext.invokeExceptionCaught(AbstractChannelHandlerContext.java:290)
at com.couchbase.client.deps.io.netty.channel.AbstractChannelHandlerContext.invokeExceptionCaught(AbstractChannelHandlerContext.java:269)
at com.couchbase.client.deps.io.netty.channel.AbstractChannelHandlerContext.fireExceptionCaught(AbstractChannelHandlerContext.java:261)
I do have a primary index on the bucket and querying via the Couchbase Web Console works fine.
My guess is, that it’s due to the changed port mapping, especially the query port 8093.
However, I couldn’t find any way to configure the port via the DefaultCouchbaseEnvironment.Builder() (as it was possible with e.g. the sdk version 2.2.7.) I also tried to go with the latest version 2.5.3, but get a cryptic exception:
2.5.3 - index out of bounds
2017-12-14 12:08:53.034 WARN 53923 --- [ cb-io-1-2] c.c.c.c.e.ResponseStatusConverter : Unknown ResponseStatus with Protocol HTTP: 999
com.couchbase.client.core.CouchbaseException: java.lang.IndexOutOfBoundsException: readerIndex(0) + length(1) exceeds writerIndex(0): PooledUnsafeDirectByteBuf(ridx: 0, widx: 0, cap: 256)
at com.couchbase.client.core.endpoint.AbstractGenericHandler.decode(AbstractGenericHandler.java:294)
Please, can you give me any guidance on
- which sdk version I can use with Couchbase 4.5 where I have full control over the port mappings
- how to configure the couchbase sdk correctly, so the ports match and N1QL Queries work
Any help is appreciated.
Best regards,
Norbert Spiess