使用 hyperledger composer 启动 hyperledger explorer 时出错

Error while starting hyperledger explorer with hyperledger composer

我已经使用 fabric-dev-servers 部署了一个简单的业务网络。一切正常,但我正在尝试将资源管理器与其集成。我已经安装了在 github 可用文档中定义的所有内容。 但是资源管理器无法在浏览器上启动。并给出错误“”无法渲染一个或多个组件”。

应用日志

[2018-08-15 15:10:13.639] [DEBUG] FabricConfiguration - Msp ID : Org1MSP
[2018-08-15 15:10:13.656] [DEBUG] FabricConfiguration - Msp ID : Org1MSP
[2018-08-15 15:10:13.716] [INFO] main - Please set logger.setLevel to DEBUG in ./app/helper.js to log the debugging.
[2018-08-15 15:10:13.716] [INFO] main - Please set logger.setLevel to DEBUG in ./app/helper.js to log the debugging.
[2018-08-15 15:10:13.803] [DEBUG] Query - ===========================================
[2018-08-15 15:10:13.803] [DEBUG] Query - ByteBuffer {
  buffer: <Buffer 08 0d 12 20 a2 c2 55 58 27 1b 18 f2 c7 28 37 b6 22 d0 d9 7c d6 12 6e f6 99 49 db 8b bd fe 52 cc 03 3c af 55 1a 20 31 7a 96 7f 57 92 da d3 fa 64 34 94 ... >,
  offset: 4,
  markedOffset: -1,
  limit: 36,
  littleEndian: true,
  noAssert: false }
[2018-08-15 15:10:13.805] [DEBUG] Query - ===========================================
[2018-08-15 15:10:13.829] [DEBUG] Query - ===========================================
[2018-08-15 15:10:13.829] [DEBUG] Query - ByteBuffer {
  buffer: <Buffer 08 0d 12 20 a2 c2 55 58 27 1b 18 f2 c7 28 37 b6 22 d0 d9 7c d6 12 6e f6 99 49 db 8b bd fe 52 cc 03 3c af 55 1a 20 31 7a 96 7f 57 92 da d3 fa 64 34 94 ... >,
  offset: 4,
  markedOffset: -1,
  limit: 36,
  littleEndian: true,
  noAssert: false }
[2018-08-15 15:10:13.829] [DEBUG] Query - ===========================================
[2018-08-15 15:10:13.854] [DEBUG] Query - <<< Instantiated Chaincodes >>>
[2018-08-15 15:10:13.854] [DEBUG] Query - name: examplebnasample, version: 0.0.2-deploy.52, path: /tmp/businessnetwork118713-16936-2rd8kb.v1444
[2018-08-15 15:15:15.137] [ERROR] metricservice - TypeError: Cannot read property 'length' of null
    at MetricService.getPeerData (/home/saeedi/blockchain-explorer/app/persistence/postgreSQL/MetricService.js:36:32)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
[2018-08-15 15:15:15.142] [DEBUG] platform - GetStatus All! [ { status: 'DOWN', server_hostname: undefined } ]
[2018-08-15 15:17:53.308] [ERROR] metricservice - TypeError: Cannot read property 'length' of null
    at MetricService.getPeerData (/home/saeedi/blockchain-explorer/app/persistence/postgreSQL/MetricService.js:36:32)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
[2018-08-15 15:17:53.309] [DEBUG] platform - GetStatus All! [ { status: 'DOWN', server_hostname: undefined } ]
[2018-08-15 15:22:23.206] [ERROR] metricservice - TypeError: Cannot read property 'length' of null
    at MetricService.getPeerData (/home/saeedi/blockchain-explorer/app/persistence/postgreSQL/MetricService.js:36:32)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
[2018-08-15 15:22:23.208] [DEBUG] platform - GetStatus All! [ { status: 'DOWN', server_hostname: undefined } ]

数据库日志

[2018-08-15 15:26:28.448] [DEBUG] pgservice -  the getRowsBySQlNoCondtion select  c.name as chaincodename,channel.name as channelname ,c.version as version,c.genesis_block_hash as genesis_block_hash,c.path as path ,txcount  as c from chaincodes as c inner join channel on c.genesis_block_hash=channel.genesis_block_hash where  c.genesis_block_hash='undefined' 
[2018-08-15 15:26:28.451] [DEBUG] pgservice -  the getRowsBySQlNoCondtion  select c.id as id,c.name as channelname,c.blocks as blocks ,c.genesis_block_hash as genesis_block_hash,c.trans as transactions,c.createdt as createdat,c.channel_hash as channel_hash from channel c
        group by c.id ,c.name ,c.blocks  ,c.trans ,c.createdt ,c.channel_hash,c.genesis_block_hash order by c.name 
[2018-08-15 15:26:28.452] [DEBUG] pgservice -  the getRowsBySQlCase select count(1) c from chaincodes where genesis_block_hash='undefined' 
[2018-08-15 15:26:28.453] [DEBUG] pgservice -  the getRowsBySQlNoCondtion select channel.name as channelname,c.requests as requests,c.genesis_block_hash as genesis_block_hash ,c.server_hostname as server_hostname from peer as c inner join  channel on c.genesis_block_hash=channel.genesis_block_hash where c.genesis_block_hash='undefined'
[2018-08-15 15:26:28.457] [DEBUG] pgservice -  the getRowsBySQlCase select count(1) c from transactions where genesis_block_hash='undefined'
[2018-08-15 15:26:28.460] [DEBUG] pgservice -  the getRowsBySQlQuery  select count(creator_msp_id), creator_msp_id
      from transactions
      where genesis_block_hash ='undefined'
      group by  creator_msp_id
[2018-08-15 15:26:28.461] [DEBUG] pgservice -  the getRowsBySQlCase select count(1) c from blocks where genesis_block_hash='undefined'
[2018-08-15 15:26:28.463] [DEBUG] pgservice -  the getRowsBySQlQuery  select t.creator_msp_id,t.txhash,t.type,t.chaincodename,t.createdt,channel.name as channelname from transactions as t  inner join channel on t.genesis_block_hash=channel.genesis_block_hash where  t.blockid >= 0 and t.id >= 0 and
        t.genesis_block_hash = 'undefined'  order by  t.id desc
[2018-08-15 15:26:28.464] [DEBUG] pgservice -  the getRowsBySQlQuery  with hours as (
            select generate_series(
              date_trunc('hour', now()) - '1day'::interval,
              date_trunc('hour', now()),
              '1 hour'::interval
            ) as datetime
          )
          select
            hours.datetime,
            count(createdt)
          from hours
          left join TRANSACTIONS on date_trunc('hour', TRANSACTIONS.createdt) = hours.datetime and genesis_block_hash ='undefined'
          group by 1
          order by 1 
[2018-08-15 15:26:28.465] [DEBUG] pgservice -  the getRowsBySQlCase select count(1) c from peer where genesis_block_hash='undefined' 
[2018-08-15 15:26:28.468] [DEBUG] pgservice -  the getRowsBySQlQuery  with minutes as (
            select generate_series(
              date_trunc('min', now()) - '1hour'::interval,
              date_trunc('min', now()),
              '1 min'::interval
            ) as datetime
          )
          select
            minutes.datetime,

Config.json

{
"network-config": {
    "Org1": {
        "name": "peerOrg1",
        "mspid": "Org1MSP",
        "peer1": {
            "requests": "grpc://127.0.0.1:7051",
            "events": "grpc://127.0.0.1:7053",
            "server-hostname": "peer0.org1.example.com"
        },
        "admin": {
            "key": "/home/saeedi/fabric-dev-servers/fabric-scripts/hlfv12/composer/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore",
            "cert": "/home/saeedi/fabric-dev-servers/fabric-scripts/hlfv12/composer/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts"
        }
    }
},
"channel": "composerchannel",
"orderers":[
            {
            "mspid": "OrdererMSP",
            "server-hostname":"orderer.example.com",
            "requests":"grpc://127.0.0.1:7050"
            }
            ],
"keyValueStore": "/tmp/fabric-client-kvs",
"configtxgenToolPath": "fabric-path/fabric-samples/bin",
"SYNC_START_DATE_FORMAT":"YYYY/MM/DD",
"syncStartDate":"2018/01/01",
"eventWaitTime": "30000",
"license": "Apache-2.0",
"version": "1.1"
}

更正组织和频道名称后的应用日志

[2018-08-17 12:57:44.387] [ERROR] Query - TypeError: Cannot read property 'queryChannels' of undefined
    at Proxy.queryChannels (/home/saeedi/blockchain-explorer/app/platform/fabric/Proxy.js:233:40)
    at Platform.setChannels (/home/saeedi/blockchain-explorer/app/platform/fabric/Platform.js:186:35)
    at Platform.initialize (/home/saeedi/blockchain-explorer/app/platform/fabric/Platform.js:151:16)
    at Function.build (/home/saeedi/blockchain-explorer/app/platform/PlatformBuilder.js:13:28)
    at platformroutes (/home/saeedi/blockchain-explorer/app/explorer/rest/platformroutes.js:17:36)
    at Explorer.initialize (/home/saeedi/blockchain-explorer/app/explorer/Explorer.js:37:17)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

我认为第一个错误出现在您的 config.json 文件的第 4 行 - 组织名称是 Org1:

"name": "Org1",

对于使用 fabric-dev-servers 脚本创建的 Fabric 的默认通道名称,我看到的另一个错误是 composerchannel

"channel": "composerchannel",

进行这些更改后,我建议重新运行 2 个数据库脚本以重新创建数据库,然后再次启动资源管理器。

我有 运行 Composer v0.20.0、Fabric v1.2 和 hyperledger-explorer v0.3.3

已更新以包含配置示例:

    {
"network-config": {
    "org1": {
        "name": "Org1",
        "mspid": "Org1MSP",
        "peer1": {
            "requests": "grpc://127.0.0.1:7051",
            "events": "grpc://127.0.0.1:7053",
            "server-hostname": "peer0.org1.example.com"
        },
        "admin": {
            "key": "/home/ibm/fabric-dev-servers/fabric-scripts/hlfv12/composer/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore",
            "cert": "/home/ibm/fabric-dev-servers/fabric-scripts/hlfv12/composer/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts"
        }
    }
},
"channel": "composerchannel",
"orderers":[
            {
            "mspid": "OrdererMSP",
            "server-hostname":"orderer.example.com",
            "requests":"grpc://127.0.0.1:7050"
            }
            ],
"keyValueStore": "/tmp/fabric-client-kvs",
"configtxgenToolPath": "fabric-path/fabric-samples/bin",
"SYNC_START_DATE_FORMAT":"YYYY/MM/DD",
"syncStartDate":"2018/01/01",
"eventWaitTime": "30000",
"license": "Apache-2.0",
"version": "1.1"
}