使用fabric-client-sdk,无法对多个对等方进行grpc调用

时间:2017-09-13 14:05:08

标签: java docker blockchain hyperledger-fabric hyperledger

通过使用fabric-sdk-java客户端,我尝试使用 docker images Windows 7 中本地Hyperledger fabric V1.0 network设置的同级中调用安装和实例化的链代码>。我可以调用和查询对等链 peer0.org1.example.com 的链代码,但是当我尝试向对等 peer0.org2.example.com 时strong>收到以下错误

2017-09-13 13:22:45,382 main ERROR Channel:2241 - Sending proposal to peer0.org2.example.com failed because of: gRPC failure=Status{code=UNAVAILABLE, description=Channel closed while performing protocol negotiation, cause=null}
java.lang.Exception: io.grpc.StatusRuntimeException: UNAVAILABLE: Channel closed while performing protocol negotiation
    at org.hyperledger.fabric.sdk.Channel.sendProposalToPeers(Channel.java:2241)
    at org.hyperledger.fabric.sdk.Channel.sendProposal(Channel.java:2155)
    at org.hyperledger.fabric.sdk.Channel.sendTransactionProposal(Channel.java:2089)
    at com.ibs.blockchain.client.utility.BlockChainUtility.sendProposal(BlockChainUtility.java:232)
    at com.ibs.blockchain.client.utility.BlockChainUtility.createFlight(BlockChainUtility.java:80)
    at com.ibs.blockchain.client.test.BCAPITest.main(BCAPITest.java:9)
Caused by: io.grpc.StatusRuntimeException: UNAVAILABLE: Channel closed while performing protocol negotiation
    at io.grpc.Status.asRuntimeException(Status.java:526)
    at io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:427)
    at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:419)
    at io.grpc.internal.ClientCallImpl.access$100(ClientCallImpl.java:60)
    at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:493)
    at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$500(ClientCallImpl.java:422)
    at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:525)
    at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
    at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:102)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

查看 docker-compose.yaml 端口映射就像

peer0.org1.example.com  
    ports:
      - 7051:7051
      - 7053:7053

peer0.org2.example.com    
        ports:
      - 8051:7051
      - 8053:7053

它仅适用于端口与tcp端口相同的端口( 7051 )但在端口 8051 的端口上遇到上述错误。为什么呢?

1 个答案:

答案 0 :(得分:0)

请澄清这个问题。在8051:7051表示法中,8051是"外部"可达端口和7051是docker镜像内的匹配端口。此外," UNAVAILABLE:频道"错误似乎表明你在同行已经加入的结构通道名称中有一个拼写错误,请仔细检查?。