初始化fabric网络时遇到的报错(一)

初始化fabric网络时遇到的报错(一),第1张


title: 初始化fabric网络时遇到的报错(一)
date: 2021-01-26 11:17:56
categories:

  • Hyperledger Fabric
    tags:
  • Hyperledger Fabric

重要声明 ,早期写的博客,后面发现里面的某些解决办法是错误的,借鉴一下就好。 报错一:

Error: Could not assemble transaction, err Proposal response was not successful, error code 500, msg error starting container: error starting container: Post http://unix.sock/containers/create?name=dev-peer0.org2.example.com-mycc-1.0: dial unix /host/var/run/docker.sock: connect: no such file or directory

问题原因

此问题是由适用于macOS的Docker Desktop的较新版本引起的。

要解决此问题,请在Docker Desktop首选项中,取消选中该框Use gRPC FUSE for file sharing, 以使用旧版osxfs文件共享,然后单击**Apply****&**Restart

报错二:

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-H7Ha88Vi-1648804299604)(https://chaincode.gitee.io/chaincode/2021/01/28/对共享账本研究的思考/image.png)]

问题原因:

环境配置问题,进入go.mod文件 重新配置

github.com/Shopify/sarama v1.27.2 // indirect
	github.com/astaxie/beego v1.12.1
	github.com/fsouza/go-dockerclient v1.7.0 // indirect
	github.com/grpc-ecosystem/go-grpc-middleware v1.2.2 // indirect
	github.com/hashicorp/go-version v1.2.1 // indirect
	github.com/hyperledger/fabric v1.4.4
	github.com/hyperledger/fabric-amcl v0.0.0-20200424173818-327c9e2cf77a // indirect
	github.com/hyperledger/fabric-sdk-go v1.0.0-rc1
	github.com/pkg/errors v0.9.1
	github.com/shiena/ansicolor v0.0.0-20200904210342-c7312218db18 // indirect
	github.com/smartystreets/goconvey v1.6.4
	github.com/sykesm/zap-logfmt v0.0.4 // indirect
	go.uber.org/zap v1.16.0 // indirect
报错三:
An HTTP request took too long to complete. Retry with --verbose to obtain debug information.
If you encounter this issue regularly because of slow network conditions, consider setting COMPOSE_HTTP_TIMEOUT to a higher value (current value: 60).
问题原因

Docker 有时候有问题。重启一下 就行

报错四:
Unable Initizlize SDK,failed to save channel: create channel failed: create channel failed: SendEnvelope failed: calling orderer 'localhost:7050' failed: Orderer Server Status Code: (400) BAD_REQUEST. Description: error validating channel creation transaction for new channel 'studentchannel', could not succesfully apply update to template configuration: error authorizing update: error validating DeltaSet: policy for [Group]  /Channel/Application not satisfied: implicit policy evaluation failed - 0 sub-policies were satisfied, but this policy requires 1 of the 'Admins' sub-policies to be satisfied!

查看order 节点日志显示:

Principal deserialization failure (MSP student.trace.com is unknown) for identity 0
问题原因:

我的问题是两个文件的MSPID 不一致导致的

config.yaml 文件

organizations:
  student:
    # configtx.yaml organizations -> ID
    mspID: student.tarce.com

    cryptoPath: /Users/tianzhiwei/go/src/LibrarySystem/conf/crypto-config/peerOrganizations/student.trace.com/users/{username}@student.trace.com/msp
    peers:
      - peer0.student.trace.com
      - peer1.student.trace.com

docker-composer-base.yaml

    environment:
      - CORE_PEER_ID=peer0.student.trace.com
      - CORE_PEER_ADDRESS=peer0.student.trace.com:7051
      - CORE_PEER_LISTENADDRESS=0.0.0.0:7051
      - CORE_PEER_CHAINCODEADDRESS=peer0.student.trace.com:7052
      - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:7052
      - CORE_PEER_GOSSIP_BOOTSTRAP=peer1.student.trace.com:8051
      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.student.trace.com:7051
      - CORE_PEER_LOCALMSPID=studentMSP
解决办法

。。。。

报错五:
Unable to install and instantiate the chaincode: failed to instantiate the chaincode: sending deploy transaction proposal failed: Multiple errors occurred: - Transaction processing for endorser [localhost:8051]: Chaincode status Code: (500) UNKNOWN. Description: error starting container: error starting container: API error (404): network _byfn not found - Transaction processing for endorser [localhost:7051]: Chaincode status Code: (500) UNKNOWN. Description: error starting container: error starting container: API error (404): network _byfn not found

试着将peer-base.yaml 文件中

- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_byfn 
注释掉了  具体有没有用还在测试中
问题六:
+ cryptogen generate --config=./organizations/cryptogen/crypto-config-org1.yaml --output=organizations
  org1.example.com
  Error generating signCA for org org1.example.com:
  mkdir organizations/peerOrganizations: permission denied
+ res=1
  Failed to generate certificates...
解决办法 :
 sudo ./network.sh up
问题七:

Unable to install and instantiate the chaincode: failed to instantiate the chaincode: sending deploy transaction proposal failed: Multiple errors occurred: - Transaction processing for endorser [localhost:7051]: Chaincode status Code: (500) UNKNOWN. Description: chaincode registration failed: container exited with 0 - Transaction processing for endorser [localhost:8051]: Chaincode status Code: (500) UNKNOWN. Description: chaincode registration failed: container exited with 0

无法安装和实例化链代码:无法实例化链代码:发送部署事务提议失败:发生多个错误:-背书人[localhost:7051]的事务处理:链代码状态代码:(500)未知。说明:链码注册失败:容器以0退出-背书人[localhost:8051]的事务处理:链码状态码:(500)未知。说明:链码注册失败:容器以0退出

问题二的另一种现实
Unable to install and instantiate the chaincode: failed to instantiate the chaincode: instantiateOrUpgradeCC timed out or cancelled
解决办法: 尝试一:
根据大佬指点,在docker-compose.yaml文件中加入一下代码  注意:每个容器后面都加这个代码
    extra_hosts:
      - "orderer.trace.com:192.168.1.255"
      - "peer0.student.trace.com:192.168.1.255"
      - "peer1.student.trace.com:192.168.1.255"
      - "peer0.library.trace.com:192.168.1.255"
      - "peer1.library.trace.com:192.168.1.255"
    networks:
      - ZFW_suyuan

尝试结果:

重新出现新的错误,idea现实错误为:
Unable to install and instantiate the chaincode: failed to instantiate the chaincode: instantiateOrUpgradeCC timed out or cancelled
docker 容器日志出现的错误为:
2021-03-17 06:56:44.702 UTC [ConnProducer] NewConnection -> ERRO 4ea Failed connecting to {orderer.trace.com:7050 [OrdererMSP]} , error: context deadline exceeded

2021-03-17 06:56:44.703 UTC [grpc] func1 -> DEBU 4eb Failed to dial orderer.trace.com:7050: cotext canceled; please retry.

2021-03-17 06:56:44.703 UTC [ConnProducer] NewConnection -> ERRO 4ec Could not connect to any of the endpoints: [{orderer.trace.com:7050 [OrdererMSP]}]

2021-03-17 06:56:44.703 UTC [deliveryClient] connect -> DEBU 4ed Connected to

2021-03-17 06:56:44.703 UTC [deliveryClient] connect -> ERRO 4ee Failed obtaining connection: could not connect to any of the endpoints: [{orderer.trace.com:7050 [OrdererMSP]}]

2021-03-17 06:56:44.703 UTC [deliveryClient] try -> WARN 4ef Got error: could not connect to any of the endpoints: [{orderer.trace.com:7050 [OrdererMSP]}] , at 7 attempt. Retrying in 1m4s
问题八:

ERROR: for orderer.itcast.cn Cannot start service orderer.itcast.cn: driver failed programming external connectivity on endpoint orderer.itcast.cn (9abfcd8ffe3dfb4c709884a7d40eabe7ff27e62f46b8f0405e5592db050d201c): Bind for 0.0.0.0:7050 failed: port is already allocated

解决办法:

不知道是什么原因,估计脑子有病

命令 docker ps 查看 并没有容器在运行

docker images 显示又正常,没有需要删除的镜像

最后将docker 重新启动了一下,它就好了 好了 就这么神奇 垃圾玩意儿

问题九:

Unable to initialize the Fabric SDK: failed to create SDK: failed to create identity manager provider: failed to initialize identity manager for organization: material: Either a cryptopath or an embedded list of users is required

无法初始化Fabric SDK:无法创建SDK:无法创建身份管理器提供程序:无法初始化组织的身份管理器:材质:需要加密路径或嵌入式用户列表

解决办法:

。。。。

问题十:

在进行fabric分支切换时输入git checkout v2.0.0 会出现以下类似问题:

error: pathspec ‘master’ did not match any file(s) known to git

error: pathspec ‘v1.4.4’ did not match any file(s) known to git

解决办法:

执行:

git add .

git commit -m ‘commit add’

问题十一:

Create channel and join error: Create channel error: error should be nil for SaveChannel of orgchannel: create channel failed: create channel failed: SendEnvelope failed: calling orderer ‘orderer.example.com:7050’ failed: Orderer Client Status Code: (2) CONNECTION_FAILED. Description: dialing connection on target [orderer.example.com:7050]: connection is in TRANSIENT_FAILURE

创建通道和加入错误:创建通道错误:组织频道的保存通道错误应为零:创建通道失败:创建通道失败:发送失败:呼叫订购者"orderer.example.com:7050"失败:订购者客户端状态代码:(2) CONNECTION_FAILED。描述:在目标上拨打连接[orderer.example.com:7050]:连接处于TRANSIENT_FAILURE瞬时故障

解决办法:

命令行

sudo su

vi /etc/host/

在里面加入

127.0.0.1 orderer.example.com

问题十二:

Create channel and join error: Org1 peers failed to JoinChannel: join channel failed: Multiple errors occurred: - SendProposal failed: Transaction processing for endorser [peer0.org1.example.com:7051]: Endorser Client Status Code: (2) CONNECTION_FAILED. Description: dialing connection on target [peer0.org1.example.com:7051]: connection is in TRANSIENT_FAILURE - SendProposal failed: Transaction processing for endorser [peer1.org1.example.com:9051]: Endorser Client Status Code: (2) CONNECTION_FAILED. Description: dialing connection on target [peer1.org1.example.com:9051]: connection is in TRANSIENT_FAILURE

创建通道和加入错误:Org1 对等器未能加入通道:加入通道失败:发生多个错误: - 发送建议失败:代言人事务处理 [peer0.org1.example.com:7051]: 背书客户端状态代码:(2) CONNECTION_FAILED。描述:在目标[peer0.org1.example.com:7051 上拨打连接:连接处于TRANSIENT_FAILURE-发送建议失败:代言人[peer1.org1.example.com:9051]的交易处理:背书客户状态代码:(2)CONNECTION_FAILED。描述:在目标上拨打连接[peer1.org1.example.com:9051]:连接处于TRANSIENT_FAILURE

解决办法:

同问题十二

127.0.0.1 pee0.org1.example.com

问题十三:

create chaincode lifecycle error: %v installCC error: LifecycleInstallCC error: Multiple errors occurred: - Transaction processing for endorser [localhost:9051]: Chaincode status Code: (500) UNKNOWN. Description: 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 "go: github.com/hyperledger/[email protected]: Get “https://proxy.golang.org/github.com/hyperledger/fabric-chaincode-go/@v/v0.0.0-20210319203922-6b661064d4d9.mod”: dial tcp 172.217.160.113:443: i/o timeout
" - Transaction processing for endorser [localhost:7051]: Chaincode status Code: (500) UNKNOWN. Description: 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 "go: github.com/hyperledger/[email protected]: Get “https://proxy.golang.org/github.com/hyperledger/fabric-chaincode-go/@v/v0.0.0-20210319203922-6b661064d4d9.mod”: dial tcp 172.217.160.81:443: i/o timeout

创建链码生命周期错误:%v 安装CC错误:生命周期安装CC错误:发生多个错误:-代言人交易处理[本地主席:9051]:链码状态代码:(500)未知。说明:未调用"安装链代码"的备份实现:无法构建链码:Docker 生成失败:Docker 图像生成失败:Docker 生成失败:生成返回的错误:1"去:github.com/hyperledger/[email protected]:获取"https://proxy.golang.org/github.com/hyperledger/fabric-chaincode-go/@v/v0.0.0-20210319203922-6b661064d4d9.mod":拨号 tcp 172.217.160.113:443:i/o 超时
“-代言人交易处理 [本地主席:7051]: 链码状态代码: (500) 未知。描述:未调用"安装链代码"的备份实现:无法构建链码:Docker 生成失败:Docker 图像生成失败:Docker 生成失败:生成返回的错误:1"去:github.com/hyperledger/[email protected]:获取"https://proxy.golang.org/github.com/hyperledger/fabric-chaincode-go/@v/v0.0.0-20210319203922-6b661064d4d9.mod”:拨号 tcp 172.217.160.81:443:i/o 超时

解决办法:

进入Chaincode目录 安装go依赖包

go env -w GOPROXY=https://goproxy.cn,direct
go env -w GO111MODULE=on
go mod init 非gapath路径就加个项目名 go mod init sacc 在gopath路径下不用加项目名
go mod tidy
go mod vendor
go env -w GO111MODULE=off

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/736263.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-28
下一篇 2022-04-28

发表评论

登录后才能评论

评论列表(0条)

保存