Following the intrustction at https://hyperledger-fabric.readthedocs.io/en/latest/Setup/JAVAChaincode/, I was able to deploy a Hyperledger Java chaincode locally, that is:
- Set up a validating peer
- Write and build a Java chaincode locally, say in a directory X (which contains a
build.gradle
file) - Deploy successfully using
peer chaincode deploy -l java -p full_path_to_X -c ...
But whenever I upload the chaincode directory to Github, and try this address during deploy: peer chaincode deploy -l java -p https://github.com/user/X
, I got the error:
"Erro getting chaincode package bytes. Error cloning git repository exit status 128"
It is not a problem with Git repository, for in it there is a Go chaincode, and I can deploy that Go chaincode successfully this way.
Would it be a problem with the Java container image used in Hyperledger has not had a feature to fetch a remote chaincode from Git?
I don't know what happen, but I only could deploy the contract thought the REST:
Resquest - POST http://127.0.0.1:7050/chaincode
{ "jsonrpc": "2.0", "method": "deploy", "params": { "type": 4, "chaincodeID": { "path": "/opt/gopath/src/github.com/hyperledger/fabric/examples/chaincode/java/SimpleSample" }, "ctorMsg": { "function": "init", "args": [ "a", "100", "b", "200" ] }, "secureContext": "jim" }, "id": 1 }
Response:
{"jsonrpc":"2.0","result":{"status":"OK","message":"0f5b1d65041bc6d500bd0f1cab50eb6154c291ef0f4596d64b6797e8ef8f7c34a179b5a2cea82253ff3d74e768512fe0481503eadcf13d18f9761bbb8133efd0"},"id":1}