运行byfn时出错:由于gradle问题,链码安装失败? [英] Error in running byfn: chaincode installation failed due to gradle issue?

查看:340
本文介绍了运行byfn时出错:由于gradle问题,链码安装失败?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的问题的继续

This is a continuation of my question found here. It seems like the nature of the error has changed hence I am asking a new question.

一个好心人指出,我以前的运行中Java版本不匹配,所以我运行了docker container ls -a:

A kind soul pointed out that the Java version mismatch in my previous run, so I ran docker container ls -a:

CONTAINER ID        IMAGE                            COMMAND                  CREATED             STATUS                  PORTS               NAMES
4bb779ce6b71        hyperledger/fabric-javaenv:2.0   "/bin/sh -c ./build.…"   2 minutes ago       Up 2 minutes                                fervent_pare
d23e83c3cde5        hyperledger/fabric-javaenv:2.0   "/bin/sh -c ./build.…"   2 days ago          Exited (0) 2 days ago                       goofy_goldstine

开始清洁,这就是我所做的:

To start clean, this was what I did:

  1. ./byfn.sh down
  2. docker container stop fervent_pare
  3. docker container prune
  1. ./byfn.sh down
  2. docker container stop fervent_pare
  3. docker container prune

以下输出来自我的下一个测试. TLDR似乎链式代码安装失败,因为Gradle构建器无法检索到一些人工制品.我有什么地方可以改变的吗?

The following output is from my next test. TLDR seems like chaincode installation failed because the Gradle builder was unable to retrieve some artefacts. Is there anything I can change anywhere?

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-24 09:08:25.968 +08 [common.tools.configtxgen] main -> INFO 001 Loading configuration
2020-02-24 09:08:26.011 +08 [common.tools.configtxgen.localconfig] completeInitialization -> INFO 002 orderer type: etcdraft
2020-02-24 09:08:26.011 +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-24 09:08:26.011 +08 [common.tools.configtxgen.localconfig] Load -> INFO 004 Loaded configuration: /root/hyperledger/fabric/fabric-samples/first-network/configtx.yaml
2020-02-24 09:08:26.013 +08 [common.tools.configtxgen] doOutputBlock -> INFO 005 Generating genesis block
2020-02-24 09:08:26.014 +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-24 09:08:26.049 +08 [common.tools.configtxgen] main -> INFO 001 Loading configuration
2020-02-24 09:08:26.085 +08 [common.tools.configtxgen.localconfig] Load -> INFO 002 Loaded configuration: /root/hyperledger/fabric/fabric-samples/first-network/configtx.yaml
2020-02-24 09:08:26.085 +08 [common.tools.configtxgen] doOutputChannelCreateTx -> INFO 003 Generating new channel configtx
2020-02-24 09:08:26.088 +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-24 09:08:26.123 +08 [common.tools.configtxgen] main -> INFO 001 Loading configuration
2020-02-24 09:08:26.160 +08 [common.tools.configtxgen.localconfig] Load -> INFO 002 Loaded configuration: /root/hyperledger/fabric/fabric-samples/first-network/configtx.yaml
2020-02-24 09:08:26.160 +08 [common.tools.configtxgen] doOutputAnchorPeersUpdate -> INFO 003 Generating anchor peer update
2020-02-24 09:08:26.162 +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-24 09:08:26.197 +08 [common.tools.configtxgen] main -> INFO 001 Loading configuration
2020-02-24 09:08:26.234 +08 [common.tools.configtxgen.localconfig] Load -> INFO 002 Loaded configuration: /root/hyperledger/fabric/fabric-samples/first-network/configtx.yaml
2020-02-24 09:08:26.234 +08 [common.tools.configtxgen] doOutputAnchorPeersUpdate -> INFO 003 Generating anchor peer update
2020-02-24 09:08:26.235 +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 peer0.org2.example.com ... done
Creating cli ... done
Creating peer1.org1.example.com ...
Creating peer0.org1.example.com ...
Creating orderer2.example.com ...
Creating peer1.org2.example.com ...
Creating orderer4.example.com ...
Creating orderer3.example.com ...
Creating orderer5.example.com ...
Creating peer0.org2.example.com ...
Creating cli ...
CONTAINER ID        IMAGE                               COMMAND             CREATED             STATUS                  PORTS                                NAMES
cc2bfe66c2b7        hyperledger/fabric-tools:latest     "/bin/bash"         1 second ago        Up Less than a second                                        cli
183832eea2b3        hyperledger/fabric-peer:latest      "peer node start"   5 seconds ago       Up Less than a second   7051/tcp, 0.0.0.0:9051->9051/tcp     peer0.org2.example.com
6330404cc6f1        hyperledger/fabric-orderer:latest   "orderer"           5 seconds ago       Up Less than a second   7050/tcp, 0.0.0.0:10050->10050/tcp   orderer4.example.com
95b97641e5bc        hyperledger/fabric-orderer:latest   "orderer"           5 seconds ago       Up 1 second             7050/tcp, 0.0.0.0:9050->9050/tcp     orderer3.example.com
0d6dcc068a1f        hyperledger/fabric-orderer:latest   "orderer"           5 seconds ago       Up Less than a second   7050/tcp, 0.0.0.0:11050->11050/tcp   orderer5.example.com
79c0dff9a2f4        hyperledger/fabric-orderer:latest   "orderer"           5 seconds ago       Up 2 seconds            7050/tcp, 0.0.0.0:8050->8050/tcp     orderer2.example.com
8d97af188efd        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
a9ca1f20ed84        hyperledger/fabric-peer:latest      "peer node start"   5 seconds ago       Up 2 seconds            7051/tcp, 0.0.0.0:8051->8051/tcp     peer1.org1.example.com
a8b4d4dcf41d        hyperledger/fabric-orderer:latest   "orderer"           5 seconds ago       Up 1 second             0.0.0.0:7050->7050/tcp               orderer.example.com
be08951a9c3b        hyperledger/fabric-peer:latest      "peer node start"   5 seconds ago       Up 3 seconds            0.0.0.0:7051->7051/tcp               peer0.org1.example.com
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

Channel name : mychannel
Creating channel...
+ 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
+ res=0
+ set +x
2020-02-24 01:08:47.906 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-02-24 01:08:47.927 UTC [cli.common] readBlock -> INFO 002 Expect block, but got status: &{NOT_FOUND}
2020-02-24 01:08:47.930 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2020-02-24 01:08:48.131 UTC [cli.common] readBlock -> INFO 004 Expect block, but got status: &{SERVICE_UNAVAILABLE}
2020-02-24 01:08:48.134 UTC [channelCmd] InitCmdFactory -> INFO 005 Endorser and orderer connections initialized
2020-02-24 01:08:48.334 UTC [cli.common] readBlock -> INFO 006 Expect block, but got status: &{SERVICE_UNAVAILABLE}
2020-02-24 01:08:48.350 UTC [channelCmd] InitCmdFactory -> INFO 007 Endorser and orderer connections initialized
2020-02-24 01:08:48.551 UTC [cli.common] readBlock -> INFO 008 Expect block, but got status: &{SERVICE_UNAVAILABLE}
2020-02-24 01:08:48.554 UTC [channelCmd] InitCmdFactory -> INFO 009 Endorser and orderer connections initialized
2020-02-24 01:08:48.755 UTC [cli.common] readBlock -> INFO 00a Expect block, but got status: &{SERVICE_UNAVAILABLE}
2020-02-24 01:08:48.757 UTC [channelCmd] InitCmdFactory -> INFO 00b Endorser and orderer connections initialized
2020-02-24 01:08:48.961 UTC [cli.common] readBlock -> INFO 00c Received block: 0
===================== Channel 'mychannel' created =====================

Having all peers join the channel...
+ peer channel join -b mychannel.block
+ res=0
+ set +x
2020-02-24 01:08:49.035 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-02-24 01:08:49.056 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-24 01:08:52.122 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-02-24 01:08:52.143 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-24 01:08:55.209 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-02-24 01:08:55.230 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-24 01:08:58.296 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-02-24 01:08:58.316 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-24 01:09:01.386 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-02-24 01:09:01.413 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-24 01:09:04.499 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-02-24 01:09:04.516 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: chaincode install failed with status: 500 - failed to invoke backing implementation of 'InstallChaincode': could not build chaincode: docker build failed: docker image build failed: docker build failed: Error returned from build: 1 "+ INPUT_DIR=/chaincode/input
+ OUTPUT_DIR=/chaincode/output
++ ++ paste -s -d find : /chaincode/input --name
.jar
+ JARS=
++ find /chaincode/input -name '*.jar'
++ wc -l
+ NUM_JARS=1
+ for DIR in ${INPUT_DIR} ${INPUT_DIR}/src
+ '[' -f /chaincode/input/build.gradle -o -f /chaincode/input/build.gradle.kts ']'
+ '[' -f /chaincode/input/pom.xml ']'
+ for DIR in ${INPUT_DIR} ${INPUT_DIR}/src
+ '[' -f /chaincode/input/src/build.gradle -o -f /chaincode/input/src/build.gradle.kts ']'
+ buildGradle /chaincode/input/src /chaincode/output
+ cd /chaincode/input/src
+ echo 'Gradle build'
+ '[' -f ./gradlew ']'
+ chmod +x ./gradlew
Gradle build
+ ./gradlew build shadowJar
Downloading https://services.gradle.org/distributions/gradle-5.6.2-bin.zip
.........................................................................................

Welcome to Gradle 5.6.2!

Here are the highlights of this release:
 - Incremental Groovy compilation
 - Groovy compile avoidance
 - Test fixtures for Java projects
 - Manage plugin versions via settings script

For more details see https://docs.gradle.org/5.6.2/release-notes.html

Starting a Gradle Daemon (subsequent builds will be faster)

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'abstore'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not resolve org.jdom:jdom2:2.0.6.
     Required by:
         project : > com.github.johnrengelman.shadow:com.github.johnrengelman.shadow.gradle.plugin:5.1.0 > com.github.jengelman.gradle.plugins:shadow:5.1.0
      > Could not resolve org.jdom:jdom2:2.0.6.
         > Could not get resource 'https://plugins.gradle.org/m2/org/jdom/jdom2/2.0.6/jdom2-2.0.6.pom'.
            > Could not GET 'https://jcenter.bintray.com/org/jdom/jdom2/2.0.6/jdom2-2.0.6.pom'.
               > jcenter.bintray.com: System error
   > Could not resolve org.ow2.asm:asm:7.0-beta.
     Required by:
         project : > com.github.johnrengelman.shadow:com.github.johnrengelman.shadow.gradle.plugin:5.1.0 > com.github.jengelman.gradle.plugins:shadow:5.1.0
      > Could not resolve org.ow2.asm:asm:7.0-beta.
         > Could not get resource 'https://plugins.gradle.org/m2/org/ow2/asm/asm/7.0-beta/asm-7.0-beta.pom'.
            > Could not GET 'https://jcenter.bintray.com/org/ow2/asm/asm/7.0-beta/asm-7.0-beta.pom'.
               > jcenter.bintray.com
   > Could not resolve org.ow2.asm:asm-commons:7.0-beta.
     Required by:
         project : > com.github.johnrengelman.shadow:com.github.johnrengelman.shadow.gradle.plugin:5.1.0 > com.github.jengelman.gradle.plugins:shadow:5.1.0
      > Could not resolve org.ow2.asm:asm-commons:7.0-beta.
         > Could not get resource 'https://plugins.gradle.org/m2/org/ow2/asm/asm-commons/7.0-beta/asm-commons-7.0-beta.pom'.
            > Could not GET 'https://jcenter.bintray.com/org/ow2/asm/asm-commons/7.0-beta/asm-commons-7.0-beta.pom'.
               > jcenter.bintray.com
   > Could not resolve commons-io:commons-io:2.5.
     Required by:
         project : > com.github.johnrengelman.shadow:com.github.johnrengelman.shadow.gradle.plugin:5.1.0 > com.github.jengelman.gradle.plugins:shadow:5.1.0
      > Could not resolve commons-io:commons-io:2.5.
         > Could not get resource 'https://plugins.gradle.org/m2/commons-io/commons-io/2.5/commons-io-2.5.pom'.
            > Could not GET 'https://jcenter.bintray.com/commons-io/commons-io/2.5/commons-io-2.5.pom'.
               > jcenter.bintray.com
   > Could not resolve org.apache.ant:ant:1.9.7.
     Required by:
         project : > com.github.johnrengelman.shadow:com.github.johnrengelman.shadow.gradle.plugin:5.1.0 > com.github.jengelman.gradle.plugins:shadow:5.1.0
      > Could not resolve org.apache.ant:ant:1.9.7.
         > Could not get resource 'https://plugins.gradle.org/m2/org/apache/ant/ant/1.9.7/ant-1.9.7.pom'.
            > Could not GET 'https://jcenter.bintray.com/org/apache/ant/ant/1.9.7/ant-1.9.7.pom'.
               > jcenter.bintray.com
   > Could not resolve org.codehaus.plexus:plexus-utils:3.0.24.
     Required by:
         project : > com.github.johnrengelman.shadow:com.github.johnrengelman.shadow.gradle.plugin:5.1.0 > com.github.jengelman.gradle.plugins:shadow:5.1.0
      > Could not resolve org.codehaus.plexus:plexus-utils:3.0.24.
         > Could not get resource 'https://plugins.gradle.org/m2/org/codehaus/plexus/plexus-utils/3.0.24/plexus-utils-3.0.24.pom'.
            > Could not GET 'https://jcenter.bintray.com/org/codehaus/plexus/plexus-utils/3.0.24/plexus-utils-3.0.24.pom'.
               > jcenter.bintray.com
   > Could not resolve org.apache.logging.log4j:log4j-core:2.11.0.
     Required by:
         project : > com.github.johnrengelman.shadow:com.github.johnrengelman.shadow.gradle.plugin:5.1.0 > com.github.jengelman.gradle.plugins:shadow:5.1.0
      > Could not resolve org.apache.logging.log4j:log4j-core:2.11.0.
         > Could not get resource 'https://plugins.gradle.org/m2/org/apache/logging/log4j/log4j-core/2.11.0/log4j-core-2.11.0.pom'.
            > Could not GET 'https://jcenter.bintray.com/org/apache/logging/log4j/log4j-core/2.11.0/log4j-core-2.11.0.pom'.
               > jcenter.bintray.com
   > Could not resolve org.vafer:jdependency:2.1.1.
     Required by:
         project : > com.github.johnrengelman.shadow:com.github.johnrengelman.shadow.gradle.plugin:5.1.0 > com.github.jengelman.gradle.plugins:shadow:5.1.0
      > Could not resolve org.vafer:jdependency:2.1.1.
         > Could not get resource 'https://plugins.gradle.org/m2/org/vafer/jdependency/2.1.1/jdependency-2.1.1.pom'.
            > Could not GET 'https://jcenter.bintray.com/org/vafer/jdependency/2.1.1/jdependency-2.1.1.pom'.
               > jcenter.bintray.com

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 21s
"
!!!!!!!!!!!!!!! Chaincode installation on peer0.org1 has failed !!!!!!!!!!!!!!!!
========= ERROR !!! FAILED to execute End-2-End Scenario ===========

ERROR !!!! Test failed


似乎我无法重现此错误,因此可能是一次性的.也就是说,如果有人遇到相同的问题,我仍然会保留这个问题.


It seems like I am unable to reproduce this error, so it may be a one-off. That said I'll still leave this question up in case anyone encounters the same issue.

推荐答案

无法从docker容器中下载插件相关性的问题.为此,我在机器上打包了所有依赖项,然后使用gradle依赖项丰富了各个docker映像,事情对我来说很有效.看到这个.

The issue that the plugin dependancies could not be downloaded from within the docker container. For this I've packed all dependancies on my machine, and then enriched respective docker image with gradle dependaencies, and things worked for me. See this.

查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆