java-sdk icon indicating copy to clipboard operation
java-sdk copied to clipboard

Getting connection refused when invoking a service using Java SDK DaprClient

Open SharAkshay opened this issue 7 months ago • 4 comments

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

  1. Both my services (ServiceA and ServiceB) are up and running as I have checked the healthchecks and it shows status up.
  2. I can invoke serviceB via it's repective dapr sidecar URL
  3. I can invoke serviceA also via it's repective dapr sidecar URL
  4. 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.

SharAkshay avatar Apr 10 '25 12:04 SharAkshay