Fabric client java exception #fabric-sdk-java


jeff.jo95z@...
 

Hi ,

I was trying to submit a transaction via fabric client (java). I got the below exception:

org.hyperledger.fabric.client.EndorseException: io.grpc.StatusRuntimeException: UNAVAILABLE: Network closed for unknown reason

 I am using peer version 2.4
What maybe the reason for this?


Mark Lewis
 

It looks like a network communication failure between your client application and the Gateway service running in the peer. If it is a transient network failure then just re-submitting might work. If it persists then you might need to investigate the cause of the network issues.

One possibility is something along the route (like a firewall or ingress controller) terminating an idle connection. In these cases, setting appropriate keep-alive values on the gRPC  channel builder when creating the client connection that you pass to the Gateway connect can be helpful. See here for details on gRPC keep-alive:

https://github.com/grpc/grpc/blob/master/doc/keepalive.md


Mark Lewis
 

I notice that the code you mailed direct to me includes:

ManagedChannel grpcChannel = ManagedChannelBuilder.forAddress(gatewayUrl, gatewayPort)
        .usePlaintext()
        .build();

It is typical for a deployed Fabric network to use TLS connections, whereas your code is specifying a plain HTTP connection. This might be the cause of the connection failure. See the asset-transfer-basic sample for an example of configuring a TLS connection:

https://github.com/hyperledger/fabric-samples/blob/c323c9580717dd6376e5e2b07ecbb00af5b3bf00/asset-transfer-basic/application-gateway-java/src/main/java/App.java#L77-L84

Please send any follow-ups to the list, not directly to me.


jeff.jo95z@...
 

sorry
It was my mistake.Instead of group reply ,I clicked on reply to author