首页 > 解决方案 > Instantiate chaincode from Java SDK

问题描述

I am trying to instantiate a chaincode from a Fabric Java SDK Client using code from this example

When i am trying to add imports inside chaincode ie github.com/hyperledger/fabric/core/chaincode/lib/ci

I am getting error from the peer

2018-05-30 17:03:24.813 UTC [endorser] simulateProposal -> ERRO 038 [mychannel][6326fbfe] failed to invoke chaincode name:"lscc" , error: Failed to generate platform-specific docker build: Error returned from build: 1 "chaincode/input/src/github.com/ify/ify.go:40:2: cannot find package "github.com/hyperledger/fabric/core/chaincode/lib/cid" in any of:
/opt/go/src/github.com/hyperledger/fabric/core/chaincode/lib/cid (from $GOROOT)
/chaincode/input/src/github.com/hyperledger/fabric/core/chaincode/lib/cid (from $GOPATH)
/opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/lib/cid

where should i install the packages inside peer in order to be visible from the go builder?

标签: hyperledger-fabrichyperledger

解决方案


You have to put everything in vendor, as stated in the coding guidelines: Hyperledger Fabric uses Go Vendoring for package management. In this way you can import external libraries in the chaincode.


推荐阅读