简体   繁体   English

如何使用Hyperledger Fabric区块链应用程序修复“错误:14无法使用:TCP写入失败”

[英]How to fix “Error: 14 UNAVAILABLE: TCP Write failed” with hyperledger Fabric blockchain application

I am actually working with this Hyperledger Fabric blockchain application on my computer ( https://github.com/rastringer/medication-blockchain ) and I can run the application on port 8000. 我实际上正在我的计算机( https://github.com/rastringer/medication-blockchain )上使用此Hyperledger Fabric区块链应用程序,并且可以在端口8000上运行该应用程序。

But I have a problem: when I want to create drug record or change drug holder with the application on port 8000, I have this message in my terminal: 但是我有一个问题:当我想使用端口8000上的应用程序创建毒品记录或更改毒品持有者时,我在终端中收到以下消息:

"... Transaction proposal was good Successfully sent Proposal and received ProposalResponse: Status - 200, message - "" Failed to invoke successfully :: Error: There was a problem with the eventhub ::Error: 14 UNAVAILABLE: TCP Write failed" “ ...事务建议很好。已成功发送建议并收到ProposalResponse:状态-200,消息-”“无法成功调用::错误:eventhub出了问题::错误:14无法使用:TCP写入失败”

And sometimes I have the same message but with 有时我有相同的信息,但是

..."TCP Read failed" ...“ TCP读取失败”

More, the green message with the success of the transaction and the transaction ID is not writing like the example in the picture, and this for the both (create drug record & change drug holder). 此外,带有成功交易和交易ID的绿色消息并未像图片中的示例那样书写,而这两者(创建毒品记录和更改毒品持有者)均如此。

But when I refresh the page on the port 8000, the new transaction appears in the table, even if there is the message error. 但是,当我刷新端口8000上的页面时,即使出现消息错误,新事务也会显示在表中。

And I checked the application in another computer, and there is not this problem (I have the last version of Linux Ubuntu 18.04.2) 并且我在另一台计算机上检查了该应用程序,并且没有这个问题(我具有最新版本的Linux Ubuntu 18.04.2)

Thank you in advance for any help :) 预先感谢您的任何帮助 :)

ur answer is correct, code sample was similar to fabric-samples/fabcar chaincode. 您的答案是正确的,代码示例类似于fabric-samples / fabcar chaincode。 In fabcar, developer didn't implement any web api, that's way he used the invoke.js. 在fabcar中,开发人员未实现任何Web api,因此他使用了invoke.js。 But in drug-app case, developer implemented the web application, where u don't need the invoke.js. 但是在药物应用程序的情况下,开发人员实现了Web应用程序,而您无需在其中调用invoke.js。 But due to the cope of the chaincode from fabcar, he forgot to remove the invoke part! 但是由于应付了fabcar的链码,他忘记了删除调用部分!

func (s *SmartContract) Invoke(APIstub shim.ChaincodeStubInterface) sc.Response {

function, args := APIstub.GetFunctionAndParameters()
if function == "queryDrug" {
    return s.queryDrug(APIstub, args)
} else if function == "initLedger" {
    return s.initLedger(APIstub)
} else if function == "recordDrug" {
    return s.recordDrug(APIstub, args)
} else if function == "queryAllDrug" {
    return s.queryAllDrug(APIstub)
} else if function == "changeDrugHolder" {
    return s.changeDrugHolder(APIstub, args)
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM