douye1940 2018-04-17 14:08
浏览 718

Hyperledger-fabric无法实例化链码

I am unable to instantiate chaincode in Hyperledge Fabric.

When executing:

peer chaincode instantiate -o orderer -n test_cc -C test-channel -v 0.1 -c '{"Args":["initLedger"]}'

I get the error:

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"}

When searching the internet, the error message is the same as on the original post at [OCI Runtimer Error when installing Hyperledger Chaincode via Java-SDK and [OCI runtime error when sending Hyperledger Fabric's chaincode instantiation request to peers, but the comments on these posts did not led me to the solution.

I am using the following software versions: Hyperledger 1.1.0 Docker version 18.03.0-ce (on Linux), Hyperledger Docker images: x86_64-1.1.0

The following steps succeed:

  • Building the chaincode. The code compiles without errors. I did not include any dependencies except the two required "github.com/hyperledger/fabric/core/chaincode/shim" and "github.com/hyperledger/fabric/protos/peer"
  • Packaging the chaincode.
  • Signing the chaincode.
  • Installing the chaincode (it ends up in the peer's /var/hyperledger/production/chaincodes/test_cc.0.1.

(Steps according to Hyperledger documentation: [http://hyperledger-fabric-docs.readthedocs.io/en/latest/chaincode4noah.html])

In the CLI Docker container, files are located in the directory /opt/gopath/src/chaincode/go/test_cc/, where 4 files are present: test_cc, test_cc.go, test_cc_pack.out, test_cc_signed_pack.out (the binary, source file, packaged file and signed package file).

The full output of the orderer and peer is:

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

It looks like there is some path issue, but the process of the creation of the chaincode container and the variables which influence this process.

I'm messing around with this issue for few days(!) now, tried all path combinations like placing the file in /opt/gopath/bin, etcetera, but to no avail.

Someone who can shine a light on this issue? Or knows what the correct paths are and where they are, or where they should be defined?

Thanks

  • 写回答

1条回答 默认 最新

  • dps123456789 2018-04-18 11:43
    关注

    The issue was that in the Go source files I used 'package test_package', which, when building, does not create an executable file, but a linkable object file.

    Having 'package main' in my Go files, then rebuilding and repackaging, made the 'peer chaincode install' and 'peer chaincode instantiate' commands working as expected.

    评论

报告相同问题?

悬赏问题

  • ¥15 Arcgis相交分析无法绘制一个或多个图形
  • ¥15 seatunnel-web使用SQL组件时候后台报错,无法找到表格
  • ¥15 fpga自动售货机数码管(相关搜索:数字时钟)
  • ¥15 用前端向数据库插入数据,通过debug发现数据能走到后端,但是放行之后就会提示错误
  • ¥30 3天&7天&&15天&销量如何统计同一行
  • ¥30 帮我写一段可以读取LD2450数据并计算距离的Arduino代码
  • ¥15 飞机曲面部件如机翼,壁板等具体的孔位模型
  • ¥15 vs2019中数据导出问题
  • ¥20 云服务Linux系统TCP-MSS值修改?
  • ¥20 关于#单片机#的问题:项目:使用模拟iic与ov2640通讯环境:F407问题:读取的ID号总是0xff,自己调了调发现在读从机数据时,SDA线上并未有信号变化(语言-c语言)