0

注意:本题基于Fabric release-1.4,因为我没有全网升级到release-2.x的选项。

在我当前的用例中,我试图通过使用InputStream它的tar.gz包来部署它来部署 Java 链代码 - 原因是我试图避免为客户端部署打包源代码。

在下面的代码段中,ccis指的是这样一个InputStream- 例如,new FileInputStream("chaincode.tar.gz").

InstallProposalRequest request = client.newInstallProposalRequest();
ChaincodeID ccid = ChaincodeID.newBuilder()
            .setName(name)
            .setVersion(version)
            .setPath(chaincodePath).build();
request.setChaincodeID(ccid);
request.setUserContext(client.getUserContext());
request.setChaincodeInputStream(ccis);
request.setChaincodeVersion(version);
Collection<ProposalResponse> responses = client.sendInstallProposal(request, peerCollection);
// TODO handle responses collection

因为chaincodePath不能为空或为空,所以我设置chaincodePath/opt/gopath/src/github.com/chaincode因为显然对于 Java 链代码,我需要通过其绝对路径来引用它。

无论如何,我都会收到以下错误:

Error: could not assemble transaction, err proposal response was not successful, error code 500, msg error starting container: error starting container: Failed to generate platform-specific docker build: Error returned from build: 1 "can't load package: package github.com/chaincode: cannot find package "github.com/chaincode" in any of:
 /opt/go/src/github.com/chaincode (from $GOROOT)
 /chaincode/input/src/github.com/chaincode (from $GOPATH)
 /opt/gopath/src/github.com/chaincode
"

我理解这个错误,因为我的 tar.gz 及其内容都不存在于该路径中,但由于我正在使用InputStream我不确定要设置什么值。

4

0 回答 0