2016-10-01 67 views
0

我遵循http://hyperledger-fabric.readthedocs.io/en/latest/Setup/Chaincode-setup/的說明。啓動並註冊chaincode時出錯Errorcode_example02

我在Windows上使用Docker Toolbox,我可以成功啓動對等和CA.這裏是日誌的時候,我開始對和CA:

[33mvp0_1   |[0m [36m13:18:52.349 [peer] chatWithSomePeers -> DEBU 04c[0m Starting up the first peer of a new network 
[33mvp0_1   |[0m 13:18:52.352 [nodeCmd] serve -> INFO 04d[0m Starting peer with ID=name:"vp0" , network ID=dev, address=172.17.0.3:7051, rootnodes=, validator=true 
[33mvp0_1   |[0m [36m13:18:52.358 [consensus/statetransfer] verifyAndRecoverBlockchain -> DEBU 04e[0m Validating existing blockchain, highest validated block is 0, valid through 0 
[33mvp0_1   |[0m 13:18:52.359 [consensus/statetransfer] blockThread -> INFO 04f[0m Validated blockchain to the genesis block 
[33mvp0_1   |[0m [36m13:18:52.360 [consensus/handler] 1 -> DEBU 050[0m Starting up message thread for consenter 
[33mvp0_1   |[0m [36m13:18:52.363 [peer] ensureConnected -> DEBU 051[0m Starting Peer reconnect service (touch service), with period = 6s 
[33mvp0_1   |[0m 13:18:52.365 [rest] StartOpenchainRESTServer -> INFO 052[0m Initializing the REST service on 0.0.0.0:7050, TLS is disabled. 

但是,當我開始chaincode下面命令

CORE_CHAINCODE_ID_NAME=mycc CORE_PEER_ADDRESS=0.0.0.0:7051 ./chaincode_example02 

我得到以下錯誤:

19:30:34.138 [shim] INFO : error with chaincode log level: logger: invalid log level level= 
19:30:34.140 [shim] DEBU : Peer address: 0.0.0.0:7052 
2016/10/01 19:30:35 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: dial tcp 0.0.0.0:7052: conne 
ctex: The requested address is not valid in its context."; Reconnecting to {"0.0.0.0:7052" <nil>} 
2016/10/01 19:30:36 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: dial tcp 0.0.0.0:7052: conne 
ctex: The requested address is not valid in its context."; Reconnecting to {"0.0.0.0:7052" <nil>} 
19:30:37.143 [shim] ERRO : Error trying to connect to local peer: grpc: timed out when dialing 
Error starting Simple chaincode: Error trying to connect to local peer: grpc: timed out when dialing2016/10/01 19:30:37 grpc: addrConn.resetTransport 
failed to create client transport: connection error: desc = "transport: dial tcp 0.0.0.0:7052: connectex: The requested address is not valid in its co 
ntext."; Reconnecting to {"0.0.0.0:7052" <nil>} 

爲什麼我得到這個錯誤?

+0

請你用'CORE_PEER_ADDRESS = 172.17.0.2嘗試:7051'? –

+0

也可以請你嘗試用'CORE_LOGGING_CHAINCODE'或'--logging-level'重寫日誌級別?可以將它們設置爲這些值中的一個:CRITICAL |錯誤|警告|通知| INFO | DEBUG' –

+0

我嘗試了多個端口,但都沒有工作。我也嘗試用'netstat -atp tcp |檢查所有監聽端口grep -i「listen」',並在CORE_PEER_ADDRESS中使用這些端口,但可悲的是,這也沒有奏效。有沒有其他方式與同伴溝通? –

回答

0

如果你試圖執行這些步驟: https://hyperledger-fabric.readthedocs.io/en/latest/Setup/Chaincode-setup/#starting-and-registering-the-chaincode

您需要更改CORE_PEER_ADDRESS = 0.0.0.0:7051內部IP dockercompose_vp0_1的

[email protected]:~$ sudo docker exec -it dockercompose_vp0_1 ifconfig | grep "inet addr" 
     inet addr:172.17.0.3 Bcast:0.0.0.0 Mask:255.255.0.0 
     inet addr:127.0.0.1 Mask:255.0.0.0 

以eth0的IP地址。這是172.17.0.3

[email protected]:/usr/hyperledger/src/first_test$ CORE_CHAINCODE_ID_NAME=mycc CORE_PEER_ADDRESS=172.17.0.3:7051 ./chaincode_example02 
08:58:16.619 [shim] INFO : error with chaincode log level: logger: invalid log level level= 
08:58:16.619 [shim] DEBU : Peer address: 172.17.0.3:7051 
08:58:16.622 [shim] DEBU : os.Args returns: [./chaincode_example02] 
08:58:16.623 [shim] DEBU : Registering.. sending REGISTER 
08:58:16.625 [shim] DEBU : []Received message REGISTERED from shim 
08:58:16.625 [shim] DEBU : []Handling ChaincodeMessage of type: REGISTERED(state:created) 
08:58:16.625 [shim] DEBU : Received REGISTERED, ready for invocations 
0

泊塢默認監聽地址 - 192.168.99.100

如此,轉到chaincode文件夾,建立chaincode using- 去建立

- 一個EXE文件將使用名稱chaincode_example02創建。

然後運行下面的代碼 -

CORE_CHAINCODE_ID_NAME = mycc CORE_PEER_ADDRESS = 192.168.99.100:7051 ./chaincode_example02