Hyperledger Fabric:对等链码实例化错误:“无法组装事务”“ msg链码注册失败”

问题描述

我们正尝试在示例网络中实例化示例链代码github.com/chaincode/chaincode_example02/go/,并且收到以下错误消息...有何建议可参考?

CLI日志:

Error: Could not assemble transaction,err proposal response was not successful,error code 500,msg chaincode registration Failed: container exited with 0

对等日志:

2020-10-29 15:20:31.341 UTC [gossip.comm] sendToEndpoint -> DEBU 5ed1 Exiting
2020-10-29 15:20:31.397 UTC [chaincode] Launch -> DEBU 5ed2 stopping due to error while launching: container exited with 0
github.com/hyperledger/fabric/core/chaincode.(*RuntimeLauncher).Launch.func1
        /opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/runtime_launcher.go:63
runtime.goexit
        /opt/go/src/runtime/asm_amd64.s:1333
chaincode registration Failed
2020-10-29 15:20:31.397 UTC [container] lockContainer -> DEBU 5ed3 waiting for container(mycc-1.0) lock
2020-10-29 15:20:31.397 UTC [container] lockContainer -> DEBU 5ed4 got container (mycc-1.0) lock
2020-10-29 15:20:31.417 UTC [container] unlockContainer -> DEBU 5edb container lock deleted(mycc-1.0)
2020-10-29 15:20:31.417 UTC [chaincode] Launch -> DEBU 5edc launch complete
2020-10-29 15:20:31.417 UTC [chaincode] Deregister -> DEBU 5edd deregister handler: mycc:1.0
2020-10-29 15:20:31.417 UTC [endorser] callChaincode -> INFO 5ede [mychannel][502c46f0] Exit chaincode: name:"lscc"  (35376ms)
2020-10-29 15:20:31.417 UTC [endorser] SimulateProposal -> ERRO 5edf [mychannel][502c46f0] Failed to invoke chaincode name:"lscc",error: container exited with 0
github.com/hyperledger/fabric/core/chaincode.(*RuntimeLauncher).Launch.func1
        /opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/runtime_launcher.go:63
runtime.goexit
        /opt/go/src/runtime/asm_amd64.s:1333
chaincode registration Failed
2020-10-29 15:20:31.417 UTC [endorser] SimulateProposal -> DEBU 5ee0 [mychannel][502c46f0] Exit
2020-10-29 15:20:31.417 UTC [lockbasedtxmgr] Done -> DEBU 5ee1 Done with transaction simulation / query execution [502c46f068a775e5966ee76e646b9444410e582877e12bd2b69aa89102061299]
2020-10-29 15:20:31.417 UTC [endorser] func1 -> DEBU 5ee2 Exit: request from 192.168.0.6:50290

解决方法

问题是由具有docker-compose网络名称(不是默认名称(byfn))引起的。 通过在正确的名称中添加环境变量CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE来解决此问题