I got this I believe pretty common error "..LedgerError - ResourceNotFound: ledger: resource not found" .
To make it simple, this is what I have:
Try simple chaincode, the given
chaincode_example02.go
codesturned off security hence no CA
(CORE_SECURITY_ENABLED=false CORE_SECURITY_PRIVACY=falss)
1 peer node only (using 0.5 version), it is a peer docker image
run in dev mode
This is how I deployed the code in dev mode, pls do verify if the cli is correct:
CORE_CHAINCODE_ID_NAME=mycc CORE_PEER_ADDRESS=0.0.0.0:30303 ./chaincode_example02
and it shows
'Received REGISTERED, ready for invocations'
Now trying to query it, pls do verify if this cli is correct :
peer chaincode query -n mycc -c '{"Function": "query", "Args": ["b"]}'
but the error returned were :
Error: Error querying chaincode: rpc error: code = 2 desc = "Error:Failed to launch chaincode spec(Could not get deployment transaction for chaincode_example02 - LedgerError - ResourceNotFound: ledger: resource not found)"
Any idea? I checked all logs under /var
but didn't find anything useful, also checked /var/hyperledger
and did see some updates under /var/hyperledger/production/db
.
This trial seems pretty straight forwards but surprise to get an error.
.. so how should I go about debugging this?
The following command,
doesn't
deploy
the chaincode, it simply start and register the chaincode with the validating peer.Once it is registered, you need to
deploy
and theninvoke
it before you canquery
.As described here,
Once it is deployed, you can invoke it as many times you want and then
query
the invoked transaction,To
invoke
,and to
query
,Also make sure that you have
peer
running in one terminal, running the chaincode in 2nd terminal, while deploying, invoking and querying transactions from the third one.