Hi there,
I’m trying to fetch a details from the damlhub Ledger and fails with UNAVAILABLE on the ListKnownPartiesResponse command below:
The host:port are ok since i’m able to connect to the Ledger
private void getPartyDetails(String partyToCheck){
String host = damlProperties.getHostIp();
int port = Integer.valueOf(damlProperties.getHostPort());
// create a stub for the PackageManagementService
//Channel channel = ManagedChannelBuilder.forAddress(host, port).usePlaintext().build();
Channel channel = null;
try {
channel = NettyChannelBuilder
.forAddress(host, port)
.negotiationType(NegotiationType.TLS)
.sslContext(GrpcSslContexts.forClient().trustManager(InsecureTrustManagerFactory.INSTANCE).build())
.build();
} catch (SSLException e) {
e.printStackTrace();
}
PartyManagementServiceGrpc.PartyManagementServiceBlockingStub pms = PartyManagementServiceGrpc.newBlockingStub(channel);
// query the ledger for parties
PartyManagementServiceOuterClass.ListKnownPartiesResponse parties = pms.listKnownParties(PartyManagementServiceOuterClass.ListKnownPartiesRequest.newBuilder().build());
// check whether party exists
Optional<PartyManagementServiceOuterClass.PartyDetails> partyDetails = parties.getPartyDetailsList().stream()
.filter(p -> p.getParty().equals(partyToCheck))
.findAny();
// create party if needed and log the result
Gson gson = new Gson();
if(partyDetails.isPresent()) {
System.out.println("Party found: " + gson.toJson(partyDetails.get()));
}
}
Error:
Caused by: io.grpc.StatusRuntimeException: UNAVAILABLE: io exception
at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:262) ~[grpc-stub-1.44.0.jar:1.44.0]
at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:243) ~[grpc-stub-1.44.0.jar:1.44.0]
at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:156) ~[grpc-stub-1.44.0.jar:1.44.0]
at com.daml.ledger.api.v1.admin.PartyManagementServiceGrpc$PartyManagementServiceBlockingStub.listKnownParties(PartyManagementServiceGrpc.java:474) ~[bindings-java-2.0.0.jar:na]
at com.sorintegrations.customerpolicyrequest.CustomerPolicyClient.getPartyDetails(CustomerPolicyClient.java:343) ~[classes/:na]
at com.sorintegrations.customerpolicyrequest.CustomerPolicyClient.sendCustomerPolicyRequest(CustomerPolicyClient.java:133) ~[classes/:na]
at com.sorintegrations.customerpolicyrequest.CustomerPolicyRequestApplication.run(CustomerPolicyRequestApplication.java:28) ~[classes/:na]
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:777) ~[spring-boot-2.6.4.jar:2.6.4]
... 10 common frames omitted