hyperledger fabric java chaincode错误

我使用peer chaincode deploy来运行去src的例子,我得到了正确的结果,然后我尝试了java src的例子, 在这里输入图像描述

在此处输入图像描述

我有一个链码,但当我用这个链码进行查询时,它告诉我:

Error: Error querying chaincode: rpc error: code = 2 desc = "Error:Failed to launch chaincode spec(Could not get deployment transaction a3a350ff98660bcade4570acd507d0b380f374ea9399194b39e0301135849feb0732 - LedgerError - ResourceNotFound: ledger: resource not found)" 

我使用docker-tool box来创建hyperledger结构的环境。

如果您在“deploy”命令的响应中看到Chaincode ID,则会生成多个参数(链接代码+参数+源代码的路径)的哈希码:

 {“jsonrpc":"2.0","result":{"status":"OK","message":"8d803651564981858842409c6a5c3bf3f6ea69f90a6a7bfb672c2c8c3b6eb4c48105c5807e52f1a5ffdce0e86966688019a6c4013ffca524d5896e0b9ae201c6"} 

这意味着您接受部署事务的请求。 从这一刻起,Fabric将尝试为您的chaincode创建一个容器,并在docker中启动它。 如果出现问题且容器未启动,您将收到以下响应:

 “LedgerError - ResourceNotFound: ledger: resource not found“ for all your commands. 

在您的示例中,您尝试在GO容器中部署Java链代码,因此响应为:

 (INFO 002 Deploy result: type GOLANG chaincodeID:...) 

发生这种情况是因为Fabric不使用“语言”变量来检测平台类型(对于09/09/2016可用的版本有效)

我设法使用以下REST请求部署Java链代码:

curl -XPOST -d '{"jsonrpc": "2.0", "method": "deploy", "params": {"type": 4,"chaincodeID": {"path": "/opt/gopath/src/github.com/hyperledger/fabric/examples/chaincode/java/SimpleSample","language": "java"}, "ctorMsg": { "args": ["init", "a", "100", "b", "1000"] }},"id": 0}' http://localhost:7050/chaincode

type:4表示此链代码是Java,应使用适当的容器。 (对于GO,我们应该使用type:1

请记住,Java目前仅使用security.enabled=false并且使用security.enabled=true您将看到以下错误消息:

 [dockercontroller] deployImage -> ERRO 095 Error building images: API error (500): {"message":"The Dockerfile (Dockerfile) cannot be empty"} 
Interesting Posts