我无法在Hyperledge Fabric中实例化chaincode。
执行时:
peer chaincode instantiate -o orderer -n test_cc -C test-channel -v 0.1 -c '{"Args":["initLedger"]}'
我得到错误:
peer0 | 2018-04-17 13:02:11.097 UTC [dockercontroller] Start -> ERRO 046 start-could not start container: API error (400): {"message":"OCI runtime create failed: container_linux.go:348: starting container process caused \"exec: \\\"chaincode\\\": executable file not found in $PATH\": unknown"}
在Internet上搜索时,错误消息与[OCI Runtimer Error when installing Hyperledger Chaincode via Java-SDK和[OCI runtime error when sending Hyperledger Fabric's chaincode instantiation request to peers]上的原始帖子相同,但这些帖子上的评论并没有使我找到解决方案。
我正在使用以下软件版本:
super 账本1.1.0
Docker版本18.03.0-ce(在Linux上),Hyperledger Docker镜像:x86_64-1.1.0
成功执行以下步骤:
“github.com/hyperledger/fabric/protos/peer”
(根据Hyperledger文档的步骤:[http://hyperledger-fabric-docs.readthedocs.io/en/latest/chaincode4noah.html]]
在CLI Docker容器中,文件位于目录
/opt/gopath/src/chaincode/go/test_cc/
中,该目录中存在4个文件:test_cc, test_cc.go, test_cc_pack.out, test_cc_signed_pack.out
(二进制文件,源文件,打包文件和签名打包文件)。订购者和对等方的完整输出为:
orderer | 2018-04-17 13:29:43.617 UTC [orderer/common/server] Broadcast -> DEBU 167 Starting new Broadcast handler
orderer | 2018-04-17 13:29:43.617 UTC [orderer/common/broadcast] Handle -> DEBU 168 Starting new broadcast loop for 172.18.0.6:41228
couchdb | [notice] 2018-04-17T13:29:43.624931Z nonode@nohost <0.16042.3> b5d38cd27d couchdb:5984 172.18.0.5 undefined GET /test-channel_lscc/test_cc?attachments=true 404 ok 2
peer | 2018-04-17 13:29:44.416 UTC [dockercontroller] Start -> ERRO 04a start-could not start container: API error (400): {"message":"OCI runtime create failed: container_linux.go:348: starting container process caused \"exec: \\\"chaincode\\\": executable file not found in $PATH\": unknown"}
peer | 2018-04-17 13:29:44.647 UTC [chaincode] Launch -> ERRO 04b launchAndWaitForRegister failed: API error (400): {"message":"OCI runtime create failed: container_linux.go:348: starting container process caused \"exec: \\\"chaincode\\\": executable file not found in $PATH\": unknown"}
peer |
peer | error starting container
peer | 2018-04-17 13:29:44.647 UTC [endorser] simulateProposal -> ERRO 04c [test-channel][39e4414a] failed to invoke chaincode name:"lscc" , error: API error (400): {"message":"OCI runtime create failed: container_linux.go:348: starting container process caused \"exec: \\\"chaincode\\\": executable file not found in $PATH\": unknown"}
peer |
peer | error starting container
orderer | 2018-04-17 13:29:44.648 UTC [orderer/common/broadcast] Handle -> DEBU 169 Received EOF from 172.18.0.6:41228, hangup
orderer | 2018-04-17 13:29:44.648 UTC [orderer/common/server] func1 -> DEBU 16a Closing Broadcast stream
似乎存在一些路径问题,但是链代码容器的创建过程以及影响该过程的变量。
我现在已经把这个问题弄乱了几天(!),尝试了所有路径组合,例如将文件放在
/opt/gopath/bin
等中,但无济于事。谁能在这个问题上大放异彩?还是知道正确的路径是什么,它们在哪里,或者应该在哪里定义?
谢谢
最佳答案
问题是在Go源文件中,我使用了“package test_package”,在构建时,它不会创建可执行文件,而是可链接的目标文件。
在Go文件中包含“package main”,然后进行重建和重新打包,使“peer chaincode安装”和“peer chaincode实例化”命令按预期工作。
关于go - Hyperledger-fabric无法实例化链码,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/49880334/