Not able to connect to 8092 using Java API

I am not able to connect to 8092 with is mapped to ‘51002’ in Virtual Machine.


[WARN] [null][ViewEndpoint]: Could not connect to endpoint, retrying with delay 32 MILLISECONDS: Connection timed out: no further information:
at Method) ~[na:1.7.0_71]
at ~[na:1.7.0_71]
at ~[core-io-1.1.4.jar:1.1.4]
at$AbstractNioUnsafe.finishConnect( ~[core-io-1.1.4.jar:1.1.4]
at [core-io-1.1.4.jar:1.1.4]
at [core-io-1.1.4.jar:1.1.4]
at [core-io-1.1.4.jar:1.1.4]
at [core-io-1.1.4.jar:1.1.4]
at$ [core-io-1.1.4.jar:1.1.4]
at$ [core-io-1.1.4.jar:1.1.4]
at [na:1.7.0_71]
[DEBUG] Received signal for outdated configuration.
[DEBUG] [][KeyValueEndpoint]: Identified Idle State, signalling config reload.

In Virtual Machine we mapped port

8091 >> 51001
8092 >> 51002

I am not able to change application to point to port # 51002.

Please help me here…

The port number is advertised by the cluster manager, so it’s not something that is configurable at the client. There are multiple services on each node.

What I’ve done in this case is set up my VM (in VirtualBox, but I’m sure others are similar) to have it’s own IP and a virtual network. That way, it works just like any other system.

Also, we have Couchbase Server for a wide variety of OSs so you can usually just run without a VM.

Hi Matt,

I am able to run application in my local m/c with localhost and 8092 port when my client and server are on same m/c.

But I have a requirement to deploy client and server on different VM and in VM we can’t use the default ports of Couchbase.

Is there any way to point Java Client to port other than 8092?

At the moment, there is no supported way. One possible way would be to write a small http proxy and do the port translation of what you get off of the HTTP bootstrap. Another possible way is to build your own static config file. Maybe @avsej knows if there is support for that.

If you’re going to have multiple nodes in the cluster, then you’ll need to open those ports though. It’s not a question of the client accessing the node alone.

Hi @ingenthr,

I can’t open the default port due to organization restriction. But I am able to map other ports of Couchbase Server and able to access them except 8092.

@vinod as @ingenthr said, there is no way to override ports, because the couchbase server advocates those ports through its configuration. Also the servers intercommunicate on specific ports, so you need an overall strategy on that.

Thanks @daschl and @ingenthr for your time.

I may need to find some workaround or ask network people to open port 8092.

@vinod its not only about 8092, but also 11210, 8091 and potentially 8093 from 4.0 on if you want to use N1QL. The intra-cluster communication uses even more high level ports (you can find all of them in the server docs).

Hi @ingenthr and @daschl, I am able to change the port by following steps mentioned in > and it’s working for me.

1 Like


Sorry to revive old conversation, but I am facing the same issue and changing the port in capi.ini did not fix our issue - the java SDK still tries to connect to 8092 as I can see in the trace logs.
In the couchbase environment builder class I can find a way to set all other ports, except 8092.

And I cannot use 8092, because we have different couchbase clusters running in docker containers on the same machine and there is no way I can use the default port for all containers.

To further elaborate on the topic - I see in the .NET SDK documentation that there is ApiPort client configuration property which can be used to change the default 8092 port, but I cannot find such anywhere in the Java SDK.

If anyone is interested I managed to change the 8092 port by manually adding and removing the VIEW Service using RemoveServiceRequest and AddServiceRequest. It seems dummy, but for development purposes is doing its job

@ivanov.lyuben would it be possible that, without the add service request, you share the TRACE log? I’d love to see what config the server returns :slight_smile:

Can you please share how you have used RemoveServicerequest to remove particular service say “Search”.