在IBM Bluemix上部署Hyperledger应用(2)

Invoke响应

200 OK access-control-allow-headers: accept, content-type Access-Control-Allow-Origin: * Content-Type: application/json Date: Sun, 30 Oct 2016 05:13:22 GMT Content-Length: 98 Server: nghttpx nghttp2/1.14.0-DEV Via: 1.1 nghttpx X-Firefox-Spdy: h2 {"jsonrpc":"2.0","result":{"status":"OK","message":"d74495ff-f3d3-44ba-acc6-5fbc767bbf21"},"id":3} 后记

发布应用代码中的path指向的是GoLang代码所在的目录,而不是GoLang源码文件, 错误响应如下:

POST https://e1bb641577f249a88acca04da0272249-vp0.us.blockchain.ibm.com:444/chaincode Content-Type: application/json { "jsonrpc": "2.0", "method": "deploy", "params": { "type": 1, "chaincodeID": { "path": "https://github.com/huyouhengbc/Hyperledger/blob/master/HelloWorld/HelloWorld.go" }, "ctorMsg": { "function": "init", "args": [ ] }, "secureContext": "user_type8_0" }, "id": 1 } -- response -- 200 OK access-control-allow-headers: accept, content-type Access-Control-Allow-Origin: * Content-Type: application/json Date: Sun, 30 Oct 2016 04:00:14 GMT Content-Length: 721 Server: nghttpx nghttp2/1.14.0-DEV Via: 1.1 nghttpx X-Firefox-Spdy: h2 {"jsonrpc":"2.0","error":{"code":-32001,"message":"Deployment failure","data":"Error when deploying chaincode: Error getting chaincode package bytes: Error getting code 'go get' failed with error: 'exit status 1'\npackage github.com/huyouhengbc/Hyperledger/blob/master/HelloWorld/HelloWorld.go: cannot find package 'github.com/huyouhengbc/Hyperledger/blob/master/HelloWorld/HelloWorld.go' in any of:\n\t/usr/local/go/src/github.com/huyouhengbc/Hyperledger/blob/master/HelloWorld/HelloWorld.go (from $GOROOT)\n\t/go/_usercode_/234208637/src/github.com/huyouhengbc/Hyperledger/blob/master/HelloWorld/HelloWorld.go (from $GOPATH)\n\t/go/src/github.com/huyouhengbc/Hyperledger/blob/master/HelloWorld/HelloWorld.go\n"},"id":1}

Bluemix提供基于基于Hyperledger Fabric v0.5的服务,如果使用最新的Hyperledger Fabric接口, 发布应用时错误响应如下:

{ "jsonrpc": "2.0", "error": { "code": -32001, "message": "Deployment failure", "data": "Error when deploying chaincode: Error getting chaincode package bytes: Error getting code 'go get' failed with error: 'exit status 2'\n# github.com/huyouhengbc/Hyperledger/HelloWorld\n/go/_usercode_/730749822/src/github.com/huyouhengbc/Hyperledger/HelloWorld/HelloWorld.go:15: undefined: shim.ChaincodeStubInterface\n/go/_usercode_/730749822/src/github.com/huyouhengbc/Hyperledger/HelloWorld/HelloWorld.go:21: undefined: shim.ChaincodeStubInterface\n/go/_usercode_/730749822/src/github.com/huyouhengbc/Hyperledger/HelloWorld/HelloWorld.go:27: undefined: shim.ChaincodeStubInterface\n" }, "id": 1 }

发布应用报错

{ "jsonrpc": "2.0", "error": { "code": -32001, "message": "Deployment failure", "data": "Error when deploying chaincode: Failed loading TCerts from TCA" }, "id": 1 }

解决方法: 在 Demo Chaincoded下发布示例应用,选择Show API details输出中使用的节点。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/5bfac6c06ee8a578abcf187b7c5a7041.html