Hyperledger fabric 运行byfn时出错:无法安装链码,rpc错误代码不可用

Hyperledger fabric 运行byfn时出错:无法安装链码,rpc错误代码不可用,hyperledger-fabric,hyperledger,hyperledger-chaincode,Hyperledger Fabric,Hyperledger,Hyperledger Chaincode,我在CentOS 7上,安装了所有必备软件,克隆了fabric samples git存储库 我指的是“构建您的第一个网络”教程。此时,我已成功运行该命令 ./byfn.sh generate 现在我想执行Java链码,所以我运行 ./byfn.sh up -l java 在开始符号之后,我看到以下输出: Build your first network (BYFN) end-to-end test + peer channel create -o orderer.example.com:

我在CentOS 7上,安装了所有必备软件,克隆了fabric samples git存储库

我指的是“构建您的第一个网络”教程。此时,我已成功运行该命令

./byfn.sh generate
现在我想执行Java链码,所以我运行

./byfn.sh up -l java
在开始符号之后,我看到以下输出:

Build your first network (BYFN) end-to-end test

+ peer channel create -o orderer.example.com:7050 -c mychannel -f ./channel-artifacts/channel.tx --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
Channel name : mychannel
Creating channel...
+ res=0
+ set +x
2020-02-21 09:14:36.439 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-02-21 09:14:36.463 UTC [cli.common] readBlock -> INFO 002 Expect block, but got status: &{NOT_FOUND}
2020-02-21 09:14:36.466 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2020-02-21 09:14:36.667 UTC [cli.common] readBlock -> INFO 004 Expect block, but got status: &{SERVICE_UNAVAILABLE}
2020-02-21 09:14:36.670 UTC [channelCmd] InitCmdFactory -> INFO 005 Endorser and orderer connections initialized
2020-02-21 09:14:36.871 UTC [cli.common] readBlock -> INFO 006 Expect block, but got status: &{SERVICE_UNAVAILABLE}
2020-02-21 09:14:36.876 UTC [channelCmd] InitCmdFactory -> INFO 007 Endorser and orderer connections initialized
2020-02-21 09:14:37.077 UTC [cli.common] readBlock -> INFO 008 Expect block, but got status: &{SERVICE_UNAVAILABLE}
2020-02-21 09:14:37.081 UTC [channelCmd] InitCmdFactory -> INFO 009 Endorser and orderer connections initialized
2020-02-21 09:14:37.281 UTC [cli.common] readBlock -> INFO 00a Expect block, but got status: &{SERVICE_UNAVAILABLE}
2020-02-21 09:14:37.284 UTC [channelCmd] InitCmdFactory -> INFO 00b Endorser and orderer connections initialized
2020-02-21 09:14:37.486 UTC [cli.common] readBlock -> INFO 00c Expect block, but got status: &{SERVICE_UNAVAILABLE}
2020-02-21 09:14:37.489 UTC [channelCmd] InitCmdFactory -> INFO 00d Endorser and orderer connections initialized
2020-02-21 09:14:37.692 UTC [cli.common] readBlock -> INFO 00e Received block: 0
===================== Channel 'mychannel' created =====================
但是测试仍然在继续,直到链码安装部分

===================== Chaincode is packaged on peer0.org1 =====================

Installing chaincode on peer0.org1...
+ peer lifecycle chaincode install mycc.tar.gz
+ res=1
+ set +x
Error: failed to endorse chaincode install: rpc error: code = Unavailable desc = transport is closing
!!!!!!!!!!!!!!! Chaincode installation on peer0.org1 has failed !!!!!!!!!!!!!!!!
========= ERROR !!! FAILED to execute End-2-End Scenario ===========
测试在peer0.org1…行的
安装chaincode处暂停了很长一段时间,然后以此错误消息结束


以下是完整的输出:

Starting for channel 'mychannel' with CLI timeout of '10' seconds and CLI delay of '3' seconds
Continue? [Y/n] Y
proceeding ...
LOCAL_VERSION=2.0.0
DOCKER_IMAGE_VERSION=2.0.0
/root/hyperledger/fabric/bin/cryptogen

##########################################################
##### Generate certificates using cryptogen tool #########
##########################################################
+ cryptogen generate --config=./crypto-config.yaml
org1.example.com
org2.example.com
+ res=0
+ set +x

Generate CCP files for Org1 and Org2
/root/hyperledger/fabric/bin/configtxgen
##########################################################
#########  Generating Orderer Genesis block ##############
##########################################################
2020-02-21 17:14:15.274 +08 [common.tools.configtxgen] main -> INFO 001 Loading configuration
2020-02-21 17:14:15.309 +08 [common.tools.configtxgen.localconfig] completeInitialization -> INFO 002 orderer type: etcdraft
2020-02-21 17:14:15.310 +08 [common.tools.configtxgen.localconfig] completeInitialization -> INFO 003 Orderer.EtcdRaft.Options unset, setting to tick_interval:"500ms" election_tick:10 heartbeat_tick:1 max_inflight_blocks:5 snapshot_interval_size:16777216
2020-02-21 17:14:15.310 +08 [common.tools.configtxgen.localconfig] Load -> INFO 004 Loaded configuration: /root/hyperledger/fabric/fabric-samples/first-network/configtx.yaml
2020-02-21 17:14:15.312 +08 [common.tools.configtxgen] doOutputBlock -> INFO 005 Generating genesis block
2020-02-21 17:14:15.312 +08 [common.tools.configtxgen] doOutputBlock -> INFO 006 Writing genesis block

#################################################################
### Generating channel configuration transaction 'channel.tx' ###
#################################################################
+ configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./channel-artifacts/channel.tx -channelID mychannel
2020-02-21 17:14:15.347 +08 [common.tools.configtxgen] main -> INFO 001 Loading configuration
2020-02-21 17:14:15.390 +08 [common.tools.configtxgen.localconfig] Load -> INFO 002 Loaded configuration: /root/hyperledger/fabric/fabric-samples/first-network/configtx.yaml
2020-02-21 17:14:15.391 +08 [common.tools.configtxgen] doOutputChannelCreateTx -> INFO 003 Generating new channel configtx
2020-02-21 17:14:15.393 +08 [common.tools.configtxgen] doOutputChannelCreateTx -> INFO 004 Writing new channel tx
+ res=0
+ set +x

#################################################################
#######    Generating anchor peer update for Org1MSP   ##########
#################################################################
+ configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org1MSPanchors.tx -channelID mychannel -asOrg Org1MSP
2020-02-21 17:14:15.434 +08 [common.tools.configtxgen] main -> INFO 001 Loading configuration
2020-02-21 17:14:15.477 +08 [common.tools.configtxgen.localconfig] Load -> INFO 002 Loaded configuration: /root/hyperledger/fabric/fabric-samples/first-network/configtx.yaml
2020-02-21 17:14:15.477 +08 [common.tools.configtxgen] doOutputAnchorPeersUpdate -> INFO 003 Generating anchor peer update
2020-02-21 17:14:15.479 +08 [common.tools.configtxgen] doOutputAnchorPeersUpdate -> INFO 004 Writing anchor peer update
+ res=0
+ set +x

#################################################################
#######    Generating anchor peer update for Org2MSP   ##########
#################################################################
+ configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org2MSPanchors.tx -channelID mychannel -asOrg Org2MSP
2020-02-21 17:14:15.525 +08 [common.tools.configtxgen] main -> INFO 001 Loading configuration
2020-02-21 17:14:15.576 +08 [common.tools.configtxgen.localconfig] Load -> INFO 002 Loaded configuration: /root/hyperledger/fabric/fabric-samples/first-network/configtx.yaml
2020-02-21 17:14:15.576 +08 [common.tools.configtxgen] doOutputAnchorPeersUpdate -> INFO 003 Generating anchor peer update
2020-02-21 17:14:15.578 +08 [common.tools.configtxgen] doOutputAnchorPeersUpdate -> INFO 004 Writing anchor peer update
+ res=0
+ set +x

Creating network "net_byfn" with the default driver
Creating volume "net_orderer.example.com" with default driver
Creating volume "net_peer0.org1.example.com" with default driver
Creating volume "net_peer1.org1.example.com" with default driver
Creating volume "net_peer0.org2.example.com" with default driver
Creating volume "net_peer1.org2.example.com" with default driver
Creating volume "net_orderer2.example.com" with default driver
Creating volume "net_orderer3.example.com" with default driver
Creating volume "net_orderer4.example.com" with default driver
Creating orderer.example.com ... done
Creating cli ... done
Creating orderer4.example.com ...
Creating peer1.org2.example.com ...
Creating orderer3.example.com ...
Creating orderer5.example.com ...
Creating peer0.org2.example.com ...
Creating peer0.org1.example.com ...
Creating orderer.example.com ...
Creating orderer2.example.com ...
Creating cli ...
CONTAINER ID        IMAGE                               COMMAND                  CREATED             STATUS                      PORTS                                NAMES
a25f3414f14e        hyperledger/fabric-tools:latest     "/bin/bash"              1 second ago        Up Less than a second                                            cli
85e4e7490b95        hyperledger/fabric-orderer:latest   "orderer"                4 seconds ago       Up Less than a second       7050/tcp, 0.0.0.0:8050->8050/tcp     orderer2.example.com
6f393ad561dc        hyperledger/fabric-peer:latest      "peer node start"        4 seconds ago       Up Less than a second       0.0.0.0:7051->7051/tcp               peer0.org1.example.com
6cfd44256f6d        hyperledger/fabric-orderer:latest   "orderer"                4 seconds ago       Up Less than a second       0.0.0.0:7050->7050/tcp               orderer.example.com
691f224ac19a        hyperledger/fabric-orderer:latest   "orderer"                5 seconds ago       Up 1 second                 7050/tcp, 0.0.0.0:11050->11050/tcp   orderer5.example.com
930177cb2965        hyperledger/fabric-peer:latest      "peer node start"        5 seconds ago       Up 1 second                 7051/tcp, 0.0.0.0:9051->9051/tcp     peer0.org2.example.com
cc4fc902a8f0        hyperledger/fabric-peer:latest      "peer node start"        5 seconds ago       Up 1 second                 7051/tcp, 0.0.0.0:10051->10051/tcp   peer1.org2.example.com
b192db94069c        hyperledger/fabric-orderer:latest   "orderer"                5 seconds ago       Up 1 second                 7050/tcp, 0.0.0.0:10050->10050/tcp   orderer4.example.com
6db78ac784c8        hyperledger/fabric-orderer:latest   "orderer"                5 seconds ago       Up 2 seconds                7050/tcp, 0.0.0.0:9050->9050/tcp     orderer3.example.com
1bea7b96c621        hyperledger/fabric-peer:latest      "peer node start"        5 seconds ago       Up 1 second                 7051/tcp, 0.0.0.0:8051->8051/tcp     peer1.org1.example.com
d23e83c3cde5        hyperledger/fabric-javaenv:2.0      "/bin/sh -c ./build.…"   17 minutes ago      Exited (0) 15 minutes ago                                        goofy_goldstine
Sleeping 15s to allow Raft cluster to complete booting
Vendoring Go dependencies ...
~/hyperledger/fabric/fabric-samples/chaincode/abstore/go ~/hyperledger/fabric/fabric-samples/first-network
./byfn.sh: line 180: go: command not found
~/hyperledger/fabric/fabric-samples/first-network
Finished vendoring Go dependencies

 ____    _____      _      ____    _____
/ ___|  |_   _|    / \    |  _ \  |_   _|
\___ \    | |     / _ \   | |_) |   | |
 ___) |   | |    / ___ \  |  _ <    | |
|____/    |_|   /_/   \_\ |_| \_\   |_|

Build your first network (BYFN) end-to-end test

+ peer channel create -o orderer.example.com:7050 -c mychannel -f ./channel-artifacts/channel.tx --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
Channel name : mychannel
Creating channel...
+ res=0
+ set +x
2020-02-21 09:14:36.439 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-02-21 09:14:36.463 UTC [cli.common] readBlock -> INFO 002 Expect block, but got status: &{NOT_FOUND}
2020-02-21 09:14:36.466 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2020-02-21 09:14:36.667 UTC [cli.common] readBlock -> INFO 004 Expect block, but got status: &{SERVICE_UNAVAILABLE}
2020-02-21 09:14:36.670 UTC [channelCmd] InitCmdFactory -> INFO 005 Endorser and orderer connections initialized
2020-02-21 09:14:36.871 UTC [cli.common] readBlock -> INFO 006 Expect block, but got status: &{SERVICE_UNAVAILABLE}
2020-02-21 09:14:36.876 UTC [channelCmd] InitCmdFactory -> INFO 007 Endorser and orderer connections initialized
2020-02-21 09:14:37.077 UTC [cli.common] readBlock -> INFO 008 Expect block, but got status: &{SERVICE_UNAVAILABLE}
2020-02-21 09:14:37.081 UTC [channelCmd] InitCmdFactory -> INFO 009 Endorser and orderer connections initialized
2020-02-21 09:14:37.281 UTC [cli.common] readBlock -> INFO 00a Expect block, but got status: &{SERVICE_UNAVAILABLE}
2020-02-21 09:14:37.284 UTC [channelCmd] InitCmdFactory -> INFO 00b Endorser and orderer connections initialized
2020-02-21 09:14:37.486 UTC [cli.common] readBlock -> INFO 00c Expect block, but got status: &{SERVICE_UNAVAILABLE}
2020-02-21 09:14:37.489 UTC [channelCmd] InitCmdFactory -> INFO 00d Endorser and orderer connections initialized
2020-02-21 09:14:37.692 UTC [cli.common] readBlock -> INFO 00e Received block: 0
===================== Channel 'mychannel' created =====================

Having all peers join the channel...
+ peer channel join -b mychannel.block
+ res=0
+ set +x
2020-02-21 09:14:37.763 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-02-21 09:14:37.783 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
===================== peer0.org1 joined channel 'mychannel' =====================

+ peer channel join -b mychannel.block
+ res=0
+ set +x
2020-02-21 09:14:40.850 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-02-21 09:14:40.869 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
===================== peer1.org1 joined channel 'mychannel' =====================

+ peer channel join -b mychannel.block
+ res=0
+ set +x
2020-02-21 09:14:43.934 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-02-21 09:14:43.954 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
===================== peer0.org2 joined channel 'mychannel' =====================

+ peer channel join -b mychannel.block
+ res=0
+ set +x
2020-02-21 09:14:47.020 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-02-21 09:14:47.040 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
===================== peer1.org2 joined channel 'mychannel' =====================

Updating anchor peers for org1...
+ peer channel update -o orderer.example.com:7050 -c mychannel -f ./channel-artifacts/Org1MSPanchors.tx --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
+ res=0
+ set +x
2020-02-21 09:14:50.102 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-02-21 09:14:50.119 UTC [channelCmd] update -> INFO 002 Successfully submitted channel update
===================== Anchor peers updated for org 'Org1MSP' on channel 'mychannel' =====================

Updating anchor peers for org2...
+ peer channel update -o orderer.example.com:7050 -c mychannel -f ./channel-artifacts/Org2MSPanchors.tx --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
+ res=0
+ set +x
2020-02-21 09:14:53.190 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-02-21 09:14:53.207 UTC [channelCmd] update -> INFO 002 Successfully submitted channel update
===================== Anchor peers updated for org 'Org2MSP' on channel 'mychannel' =====================

+ peer lifecycle chaincode package mycc.tar.gz --path /opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/java/ --lang java --label mycc_1
+ res=0
+ set +x
===================== Chaincode is packaged on peer0.org1 =====================

Installing chaincode on peer0.org1...
+ peer lifecycle chaincode install mycc.tar.gz
+ res=1
+ set +x
Error: failed to endorse chaincode install: rpc error: code = Unavailable desc = transport is closing
!!!!!!!!!!!!!!! Chaincode installation on peer0.org1 has failed !!!!!!!!!!!!!!!!
========= ERROR !!! FAILED to execute End-2-End Scenario ===========

ERROR !!!! Test failed

Java容器正在正常运行,但错误仍然存在。

d23e83c3cde5 hyperledger/fabric javaenv:2.0”/bin/sh-c./build…“17分钟前退出(0)15分钟前
这是由于Java版本不匹配造成的。@AdityaArora感谢您指出这一点。在第二次测试运行之后,错误似乎发生了变化,因此我在@AdityaArora中发布了延续,我无法在第二个问题中重现错误,因此请忽略这一点。我在这里编辑了我的问题,并添加了其他输出。
d23e83c3cde5 hyperledger/fabric javaenv:2.0”/bin/sh-c./build…“17分钟前退出(0)15分钟前退出
这是由于java版本不匹配造成的。@AdityaArora感谢您指出这一点。在第二次测试运行之后,错误似乎发生了变化,因此我在@AdityaArora中发布了延续,我无法在第二个问题中重现错误,因此请忽略这一点。我在这里编辑了我的问题,并添加了其他输出。
CONTAINER ID        IMAGE                               COMMAND                  CREATED             STATUS              PORTS                                NAMES
6182b99f3483        hyperledger/fabric-javaenv:2.0      "/bin/sh -c ./build.…"   4 minutes ago       Up 4 minutes                                             suspicious_galileo
158e8bbd501b        hyperledger/fabric-tools:latest     "/bin/bash"              5 minutes ago       Up 5 minutes                                             cli
1d4f0e232e58        hyperledger/fabric-peer:latest      "peer node start"        5 minutes ago       Up 5 minutes        0.0.0.0:7051->7051/tcp               peer0.org1.example.com
90ba9fb67fae        hyperledger/fabric-orderer:latest   "orderer"                5 minutes ago       Up 5 minutes        7050/tcp, 0.0.0.0:11050->11050/tcp   orderer5.example.com
e4f730446f05        hyperledger/fabric-orderer:latest   "orderer"                5 minutes ago       Up 5 minutes        0.0.0.0:7050->7050/tcp               orderer.example.com
a9c126e1e280        hyperledger/fabric-orderer:latest   "orderer"                5 minutes ago       Up 5 minutes        7050/tcp, 0.0.0.0:8050->8050/tcp     orderer2.example.com
c53240f4d9fe        hyperledger/fabric-peer:latest      "peer node start"        5 minutes ago       Up 5 minutes        7051/tcp, 0.0.0.0:9051->9051/tcp     peer0.org2.example.com
7c96596eda01        hyperledger/fabric-peer:latest      "peer node start"        5 minutes ago       Up 5 minutes        7051/tcp, 0.0.0.0:10051->10051/tcp   peer1.org2.example.com
4fabd60e9af4        hyperledger/fabric-peer:latest      "peer node start"        5 minutes ago       Up 5 minutes        7051/tcp, 0.0.0.0:8051->8051/tcp     peer1.org1.example.com
c5ffe6032bdd        hyperledger/fabric-orderer:latest   "orderer"                5 minutes ago       Up 5 minutes        7050/tcp, 0.0.0.0:10050->10050/tcp   orderer4.example.com
04ec9beedce6        hyperledger/fabric-orderer:latest   "orderer"                5 minutes ago       Up 5 minutes        7050/tcp, 0.0.0.0:9050->9050/tcp     orderer3.example.com