Issue in connecting to couchbase server (installed in one vm) from a java rest application in different vm

We have a linux box with multiple vms. The couchbase server and sync gateway are installed in vm3, whereas my java application is installed n vm1. When I installed the jar the logs showed that it is connected to vm3, but when I hit any GET request from postman, I get the following error in the response:
{
“status”: 500,
“error”: “Internal Server Error”,
“message”: “Could not open bucket.”…
}

also, the logs now show hitting to some localhost ports, but when I install the same jar on same vm as the couchbase server(vm3), there is no error on hitting the application. All logs below:

logs when jar is installed:

2019-05-27 05:25:07.572 INFO 14598 — [ cb-io-3-1] com.couchbase.client.core.node.Node : Connected to Node 10.95.59.4/10.95.59.4
2019-05-27 05:25:07.777 INFO 14598 — [-computations-6] c.c.c.core.config.ConfigurationProvider : Selected network configuration: default


logs when GET api is hit:

2019-05-27 05:25:58.200 WARN 14598 — [ cb-io-1-1] c.c.client.core.endpoint.Endpoint : [localhost:11210][KeyValueEndpoint]: Could not connect to remote socket: Connection refused: localhost/127.0.0.1:11210
2019-05-27 05:25:58.231 WARN 14598 — [ cb-io-1-3] c.c.client.core.endpoint.Endpoint : [localhost:8091][ConfigEndpoint]: Could not connect to remote socket: Connection refused: localhost/127.0.0.1:8091
2019-05-27 05:25:58.250 WARN 14598 — [ cb-io-1-4] c.c.client.core.endpoint.Endpoint : [localhost:8091][ConfigEndpoint]: Could not connect to remote socket: Connection refused: localhost/127.0.0.1:8091
2019-05-27 05:25:58.250 WARN 14598 — [ cb-io-1-4] c.c.client.core.endpoint.Endpoint : Error during reconnect: com.couchbase.client.deps.io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: localhost/127.0.0.1:8091
2019-05-27 05:25:58.263 ERROR 14598 — [nio-8182-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path threw exception [Request processing failed; nested exception is com.couchbase.client.core.config.ConfigurationException: Could not open bucket.] with root cause

java.net.ConnectException: Connection refused
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) ~[na:1.8.0_212]
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717) ~[na:1.8.0_212]
at com.couchbase.client.deps.io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:225) ~[core-io-1.7.2.jar!/:na]
at com.couchbase.client.deps.io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:291) ~[core-io-1.7.2.jar!/:na]
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:634) ~[core-io-1.7.2.jar!/:na]
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:581) ~[core-io-1.7.2.jar!/:na]
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:498) ~[core-io-1.7.2.jar!/:na]
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:460) ~[core-io-1.7.2.jar!/:na]
at com.couchbase.client.deps.io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:131) ~[core-io-1.7.2.jar!/:na]
at com.couchbase.client.deps.io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[core-io-1.7.2.jar!/:na]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_212]


I also updated the host-name on vm3 after some inputs from google but nothing worked, please assist as its an urgent requirement now.

also, previously faced an issue : (http://Apr 15 Error creating bean with name ‘couchbaseClient’ defined in class path resource) but it resolved when we moved to a core 4 processor machine.