为什么dev模式下的chaincode无法连接到peer同时抛出未实现的desc =未知服务protos.ChaincodeSupport

问题描述 投票:1回答:1

版本v1.1.0-preview之前的结构代码是可以的,但我下载了结构版本v1.1.0-preview。我用开发模式启动程序,而不是停靠模式。 orderer,peer,example01 cofiguration如下:

orderer configuration

peer configuration

然后,example01 cofiguration,orderer,peer可以正常启动,但是example01无法启动,看来grpc无法连接成功,

error message for example01

GOROOT=/opt/go1.9.2 #gosetup
GOPATH=/home/test/gopath #gosetup
/opt/go1.9.2/bin/go build -i -gcflags "-N -l" -tags nopkcs11 "-ldflags=-linkmode internal" -o /tmp/___example01 github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example01 #gosetup
/tmp/___example01 -peer.address 127.0.0.1:7051 #gosetup
2017-12-29 15:14:01.381 CST [shim] SetupChaincodeLogging -> INFO 001 Chaincode log level not provided; defaulting to: INFO
2017-12-29 15:14:01.381 CST [shim] SetupChaincodeLogging -> INFO 002 Chaincode (build level: ) starting up ...
2017-12-29 15:14:01.383 CST [shim] func1 -> ERRO 003 Received error from server, ending chaincode stream: rpc error: code = Unimplemented desc = unknown service protos.ChaincodeSupport
Error starting Simple chaincode: rpc error: code = Unimplemented desc = unknown service protos.ChaincodeSupport
Process finished with exit code 0

我考虑了chaincode.go中的关键代码,方法chatWithPeer失败了,它使用了chaincode_shim.proto grpc服务,它失败了。

// Interface that provides support to chaincode execution. ChaincodeContext
// provides the context necessary for the server to respond appropriately.
service ChaincodeSupport {

    rpc Register(stream ChaincodeMessage) returns (stream ChaincodeMessage) {}


}

所以,为什么它扔Unimplemented desc = unknown service protos.ChaincodeSupport

hyperledger-fabric grpc
1个回答
1
投票

你使用的是错误的端口。在v1.1中,我们切换到使用端口7052.在v1.0中它是7051。

© www.soinside.com 2019 - 2024. All rights reserved.