Couchbase issue with Java and Docker setup

Java SDK openbucket causes a timeout with my Docker container.
I know it is working properly as Python SDK works with the same configuration(ip address) and others as well.

I have tested also the Java sdk with basic linux Couchbase set up and that works as well.

Can you post what port mapping you’re using, assuming you’re running Java in the host that is accessing a localhost docker container? There are some bad instructions floating around that are missing port 11210.

Also, you could try cbping to verify all client accessible ports are open.

Same person on Slack(protomike), different name here just trying to get suggestions

This is what I am using to connect.
Cluster cluster = CouchbaseCluster.create(“myipaddresshere:8091”);
Bucket bucket = cluster.openBucket(“default”, “”);

DNS Reverse Lookup of is slow, took 4504ms
Caused by: java.util.concurrent.TimeoutException

Thank You

The reverse DNS lookup being slow is interesting. Is this from your laptop to a local docker container?

If so, you could add the IP and hostname to your local /etc/hosts. That wouldn’t make actual DNS resolve faster, but it would make a gethostbyname() syscall equivalent resolve quickly.

Two other things:
What’s the stack trace with the TImeoutException?
What ports do you have mapped?

Was thinking about that Host File for a while now but didn’t get to it thinking “hey, it is connecting to the couchbase server but not the bucket”. You mentioning it to me again made me go back and yes, adding the ip to the host file solved the openBucket issue.

Thank You!.

Glad that worked! Interesting problem, as I’ve not run into that myself using docker.

Was strange. Like I said I used Python, Php, and even .Net. None of the other sdks had an issue connecting to the same exact Docker setup.

I do know the JVM implements some of it’s own DNS resolving for some legacy and some capability reasons. This used to be more of a problem than it is today, but my guess is that something in our code is doing a reverse lookup and tripping on it there. Glad we figured it out.

Yes the Java SDK does reverse DNS lookups indirectly by calling methods on Java classes that do that. We are looking to improve that in the future, but it involves some trickery to make sure to only ever deal with ipaddrs.