首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >设置Hyperledger Explorer时出现问题:- ReferenceError:未定义host_port

设置Hyperledger Explorer时出现问题:- ReferenceError:未定义host_port
EN

Stack Overflow用户
提问于 2019-01-22 20:50:41
回答 2查看 469关注 0票数 1

我正在尝试为具有3个组织的fabric swarm网络设置hyperledger explorer。

{

代码语言:javascript
运行
复制
 "network-configs": {
         "network-1": {
         "version": "1.0",
             "clients": {
                  "client-1": {
                     "tlsEnable": false,
                      "organization": "StancOrgMSP",
                      "channel": "masterchannel",
                       "credentialStore": {
                                "path": "./tmp/credentialStore_Org1/credential",
                                "cryptoStore": {
          "path": "./tmp/credentialStore_Org1/crypto"
                                  }
                       }
                    }
            },
             "channels": {
                    "masterchannel": {
                          "peers": {
                              "HOSTA.peerStanc_com": {}
                           },
                           "connection": {
                                        "timeout": {
                                            "peer": {
                                               "endorser": "6000",
                                                "eventHub": "6000",
                                                 "eventReg": "6000"
                                              }
                                      }
                           }
                       }
                   },
                   "organizations": {
                           "StancOrgMSP": {
                              "mspid": "StancOrgMSP",
                              "fullpath": false,
                              "adminPrivateKey": {
                               "path": "/home/ubuntu/ST/fabric-swarm/crypto-config/peerOrganizations/peerStanc_com/users/Admin@peerStanc_com/msp/keystore"
                             },
                              "signedCert": {
                                 "path": "/home/ubuntu/ST/fabric-swarm/crypto-config/peerOrganizations/peerStanc_com/users/Admin@peerStanc_com/msp/signcerts"
                            }
                        },
                         "StancOrgAMSP": {
                              "mspid": "StancOrgAMSP",
                              "adminPrivateKey": {
                                "path": "/home/ubuntu/ST/fabric-swarm/crypto-config/peerOrganizations/peerStancA_com/users/Admin@peerStancA_com/msp/keystore"
                           },
                             "signedCert": {
                                "path": "/home/ubuntu/STANC/A-HYPERLEDGER/fabric-swarm/crypto-config/peerOrganizations/peerStancA_com/users/Admin@peerStancA_com/msp/signcerts"
                          }
                       },
                      "StancOrgBMSP": {
                           "mspid": "StancOrgBMSP",
                           "adminPrivateKey": {
                                "path": "/home/ubuntu/ST/fabric-swarm/crypto-config/peerOrganizations/peerStancB_com/users/Admin@peerStancB_com/msp/keystore"
                         },
                         "signedCert": {
                                 "path": "/home/ubuntu/ST/fabric-swarm/crypto-config/peerOrganizations/peerStancB_com/users/Admin@peerStancB_com/msp/signcerts"
                       }
                    },
                    "StancOrdererMSP": {
                          "mspid": "StancOrdererMSP",
                          "adminPrivateKey": {

        "path": "/home/ubuntu/ST/fabric-swarm/crypto-config/ordererOrganizations/StancOrdr_com/users/Admin@StancOrdr_com/msp/keystore"
                           }
                        }
                 },
                "peers": {
                    "HOSTA.peerStanc_com": {
                       "tlsCACerts": {
                            "path": "/home/ubuntu/ST/fabric-swarm/crypto-config/peerOrganizations/peerStanc_com/peers/HOSTA.peerStanc_com/tls/ca.crt"
                       },
                       "url": "grpc://localhost:7051",
                       "eventUrl": "grpc://localhost:7053",
                       "grpcOptions": {
                           "ssl-target-name-override": "HOSTA.peerStanc_com"
                        }
                       }
                     },
                     "orderers": {
                           "StancOrderer.StancOrdr_com": {
                            "url": "grpc://localhost:7050"
                            }
                       }
                    },
                   "network-2": {}
                 },
                  "configtxgenToolPath": "/home/ubuntu/ST/bin",
                 "license": "Apache-2.0"
    }

我已经通过在同级section.But中添加每个组织的3个同级更新了配置,但问题仍然存在。我已附上日志以供参考。

以下是app目录中的日志。

代码语言:javascript
运行
复制
[2019-01-21 19:31:41.108] [DEBUG] FabricClient - then privateKeyPEM data
[2019-01-21 19:31:41.109] [DEBUG] FabricClient - then signedCertPEM data
[2019-01-21 19:31:41.111] [DEBUG] FabricClient - then user
[2019-01-21 19:31:41.111] [DEBUG] FabricClient - Successfully created user [client-1_StancOrdererMSPAdmin] for client [client-1]
[2019-01-21 19:31:41.112] [DEBUG] FabricClient - Client.createUser missing required organization.
[2019-01-21 19:31:41.112] [DEBUG] FabricClient - Client.createUser missing required organization.

以下是控制台目录中的日志

代码语言:javascript
运行
复制
ReferenceError: host_port is not defined
    at FabricClient.initializeChannelFromDiscover (/home/ubuntu/HYPERLEDGER-EXPLORER1/blockchain-explorer/app/platform/fabric/FabricClient.js:408:17)
    at <anonymous>
Received kill signal, shutting down gracefully
Closed out connections

任何人都可以面对这个问题吗?我如何解决这个问题?

EN

回答 2

Stack Overflow用户

发布于 2019-02-13 22:12:12

我也得到了这个错误。查看docker容器中的源文件,您可以找到以下行

代码语言:javascript
运行
复制
logger.error(
  'Peer configuration is not found in config.json for peer %s and url %s , so peer status not work for the peer',
  host_port,
  requesturl
);

因此,该错误是由于使用了之前未定义的变量host_port造成的。但是,最初的错误是您的浏览器config.json没有包含所有必要的对等配置。例如,您只定义了HOSTA.peerStanc_com,而您的网络包含其他对等点(由发现服务找到)。

票数 0
EN

Stack Overflow用户

发布于 2019-03-07 18:43:17

所有节点都需要在配置中定义。JSON文件。检查您的配置。JSON根据文档定义正确。因为文件中没有定义通过服务发现找到的节点,所以会上报错误。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54308695

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档