0
在最新級別使用hyperledger-composer NodeJS SDK。使用所提供的示例代碼在作曲家管理員平hyperledger-composer nodejs sdk ping失敗
var fs = require('fs');
var path = require('path');
var composer = require('composer-admin');
var composerClient = require('composer-client');
var composerCommon = require('composer-common');
var adminConnection = new composer.AdminConnection();
adminConnection.connect(config.composer.connectionProfile, config.composer.adminID, config.composer.adminPW)
.then(function(){
adminConnection.ping()
.then(function(result){
console.log("network ping successful: ",result);
res.send({ping: result});
})
.catch(function(error){
var _error = error;
console.log("network ping failed: "+_error);
res.send({ping: _error.toString()});
});
});
命令執行時試圖平網絡,獲得以下響應:
Error: error trying to ping.
Error: error trying to query chaincode.
Error: Missing "chaincodeId" parameter in the proposal request
然而,ping命令沒有參數。請幫助?
檢查composer-admin代碼,顯示在ping之前評估安全上下文。當我查看new composer.AdminConnection()
請求返回的安全上下文對象時,網絡標識符對象爲空 - 未定義。如果我用下面的代碼
adminConnection.securityContext.connection.businessNetworkIdentifier = "[email protected]";
更新我的網絡標識符字段中的錯誤信息更改爲:
Error: error trying to ping.
Error: error trying to query chaincode.
Error: could not find chaincode with name '[email protected]' - make sure the chaincode [email protected] has been successfully instantiated and try again
使用管理界面部署,列出網絡返回該網絡。不明白爲什麼消息是關於鏈接代碼的,因爲更新是由作曲家歸檔創建並通過作曲家部署服務部署的網絡標識符。