ERRO 003 Error trying to connect to local peer: co

2019-04-14 09:57发布

问题:

Following my previous question. I'm still trying to make the tutorial "Chaincode for Developers" work. It still does not work :

Terminal 2 - Build & start the chaincode, getting this error when running chaincode :

userChaincodeStreamGetter -> ERRO 003 Error trying to connect to local peer: context deadline exceeded

回答1:

After coming across this issue, I checked which ports which were being used by "peer", and was surprised to see that the port in question, 7052, was not listed as a peer node port.

So, I updated to this command, i.e. changing port 7052 to 7051:

CORE_PEER_ADDRESS=peer:7052 CORE_CHAINCODE_ID_NAME=mycc:0 ./sacc

TO:

CORE_PEER_ADDRESS=peer:7051 CORE_CHAINCODE_ID_NAME=mycc:0 ./sacc

Following that change, startup seems to work correctly (although the behavior soon looks like a hung process, once the code was registered. Subsequent tutorial steps worked as expected.)

LOGS:

ORIGINAL (FAILURE):

root@8e77a5eef847:/opt/gopath/src/chaincode/sacc# CORE_PEER_ADDRESS=peer:7052 CORE_CHAINCODE_ID_NAME=mycc:0 ./sacc

2018-03-27 02:18:56.211 UTC [shim] SetupChaincodeLogging -> INFO 001 Chaincode log level not provided; defaulting to: INFO

2018-03-27 02:18:56.211 UTC [shim] SetupChaincodeLogging -> INFO 002 Chaincode (build level: ) starting up ...

2018-03-27 02:18:59.212 UTC [shim] userChaincodeStreamGetter -> ERRO 003 Error trying to connect to local peer: context deadline exceeded

CORRECTED (SUCCESS):

root@8e77a5eef847:/opt/gopath/src/chaincode/sacc# CORE_PEER_ADDRESS=peer:7051 CORE_CHAINCODE_ID_NAME=mycc:0 ./sacc

2018-03-27 02:54:22.858 UTC [shim] SetupChaincodeLogging -> INFO 001 Chaincode log level not provided; defaulting to: INFO

2018-03-27 02:54:22.858 UTC [shim] SetupChaincodeLogging -> INFO 002 Chaincode (build level: ) starting up ...

(process continues in background?)