Azure Service Fabric: Service Remoting in Java with Reliable Services Fails

2020-02-14 java azure azure-service-fabric service-fabric-stateless service-fabric-actor

I have created a simple Stateless Reliable Service on a Service Fabric cluster set up on Azure. I have tried to access the service using Service Remoting as guided in I have created the following Java files to implement the codes suggested in the guide:

  1. TestRemoteAccess: implements the following methods - helloWorldAsync() and createServiceInstanceListeners()
  2. TestRemoteAccessInterface: interface of the service that includes - CompletableFuture helloWorldAsync();
  3. TestClient: calls the remote service method using the following code -

    MyService helloWorldClient = ServiceProxyBase.create(MyService.class, newURI("fabric:/MyApplication/MyHelloWorldService"));
    CompletableFuture message = helloWorldClient.helloWorldAsync();
    System.out.println(" TEST -- " + message);

When I try to run the TestClient as a Java application from one of the nodes inside the service fabric cluster I get the following error message:

system.fabric.exception.FabricException: TEST -- [email protected][Completed exceptionally]

What could be the reason for such error even when I am trying to access the service from within the service fabric cluster? To summarise, I would like to access a stateless service from within the service fabric cluster using a TestClient Java app.