java-sdk
java-sdk copied to clipboard
Getting connection refused when invoking a service using Java SDK DaprClient
I have two services running in docker container under same network with their respective dapr sidecars which are also part of same docker network. Now I am trying to invoke serviceB endpoint from serviceA using dapr client like this
daprClient.invokeMethod(appId, methodEndpoint, payload, HttpExtension.POST, Response.class);
When I do so I get below exception Error invoking Service B: java.net.ConnectException reactor.core.Exceptions$ReactiveException: java.net.ConnectException at reactor.core.Exceptions.propagate(Exceptions.java:408) ~[reactor-core-3.5.10.jar!/:3.5.10] at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:101) ~[reactor-core-3.5.10.jar!/:3.5.10]
Could you help me with this issue?
Please consider below points
- Both my services (ServiceA and ServiceB) are up and running as I have checked the healthchecks and it shows status up.
- I can invoke serviceB via it's repective dapr sidecar URL
- I can invoke serviceA also via it's repective dapr sidecar URL
- I have curl the serviceB endpoint via it's dapr sidecar from inside of the serviceA cdocker container so that connectivity works
I can see the dapr sidecar container logs as well and it has discovered the respective services so all looks good over there also.