【问题标题】:error while accessing Hyperldger explorer "Cannot GET /"访问 Hyperldger 资源管理器时出错“无法获取 /”
【发布时间】:2020-01-29 06:45:58
【问题描述】:

我已经使用 Explorer(最新版本)配置了我们的 Fabric 网络(v1.4)。

node --version v8.16.0

数据库日志中没有错误 没有应用程序级别错误 Explorer 同步过程持续为网络进行 能够查看数据库中更新的数据 http://localhost:8080/api-docs/ (Explorer Swagger) 工作正常。 然而,在访问 http://localhost:8080/ 时,我得到了

无法获取 / 错误。

Chrome 检查日志 -

Failed to load resource: the server responded with a status of http://localhost:8080/ 404 (Not Found)

控制台日志 -

[2020-01-28T22:30:53.167] [INFO] PgService - SSL to Postgresql disabled
[2020-01-28T22:30:53.167] [INFO] PgService - connecting to Postgresql postgres://hppoc:******@127.0.0.1:5432/fabricexplorer
[2020-01-28T22:30:54.285] [INFO] Platform -  client_configs.name  first-network  client_configs.profile  ./connection-profile/first-network.json
[2020-01-28T22:30:54.285] [INFO] Platform - FabricUtils.createFabricClient
[2020-01-28T22:30:54.286] [INFO] FabricConfig - config.client.tlsEnable  true
[2020-01-28T22:30:54.287] [INFO] FabricGateway - peer0.org1.example.com
[2020-01-28T22:30:54.287] [INFO] FabricGateway - /path/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/Admin@org1.example.com-cert.pem
adminPrivateKeyPath  /path/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore/e65fa2dd29a69b2b28f9e439d1a8d555d411e9906e5a20d0a7341207a3a46424_sk
[2020-01-28T22:30:54.287] [INFO] FabricConfig - FabricConfig, this.config.channels  mychannel
[2020-01-28T22:30:54.607] [INFO] FabricClient -  FabricClient.discover_results  endpoint  { host: 'orderer.example.com', port: 7050 }
[2020-01-28T22:30:54.638] [INFO] Platform - FabricUtils.createDetachClient
[2020-01-28T22:30:54.640] [INFO] Platform - initializeListener, client_name, client  first-network { name: 'first-network',
  profile: './connection-profile/first-network.json' }
[2020-01-28T22:30:54.646] [INFO] main - Please open web browser to access :http://localhost:8080/
[2020-01-28T22:30:54.646] [INFO] main - pid is 18213
[2020-01-28T22:30:54.782] [INFO] PgService - SSL to Postgresql disabled
[2020-01-28T22:30:54.782] [INFO] PgService - connecting to Postgresql postgres://hppoc:******@127.0.0.1:5432/fabricexplorer
[2020-01-28T22:30:55.397] [INFO] SyncPlatform - Updating the client network and other details to DB
[2020-01-28T22:30:55.404] [INFO] SyncServices - SyncServices.synchNetworkConfigToDB client  first-network  channel_name  mychannel
[2020-01-28T22:30:55.427] [INFO] FabricClient -  FabricClient.discover_results  endpoint  { host: 'orderer.example.com', port: 7050 }
[2020-01-28T22:30:55.528] [INFO] SyncPlatform - Sync process is started for the network : [first-network] and client : [first-network]
[2020-01-28T22:30:55.530] [INFO] FabricConfig - config.client.tlsEnable  true
[2020-01-28T22:30:55.530] [INFO] FabricGateway - peer0.org1.example.com
[2020-01-28T22:30:55.530] [INFO] FabricGateway - /path/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/Admin@org1.example.com-cert.pem
adminPrivateKeyPath  /path/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore/e65fa2dd29a69b2b28f9e439d1a8d555d411e9906e5a20d0a7341207a3a46424_sk
[2020-01-28T22:30:55.530] [INFO] FabricConfig - FabricConfig, this.config.channels  mychannel
[2020-01-28T22:30:55.798] [INFO] FabricClient -  FabricClient.discover_results  endpoint  { host: 'orderer.example.com', port: 7050 }
[2020-01-28T22:30:55.833] [INFO] SyncServices - SyncServices.synchNetworkConfigToDB client  first-network  channel_name  mychannel
[2020-01-28T22:30:55.865] [INFO] FabricClient -  FabricClient.discover_results  endpoint  { host: 'orderer.example.com', port: 7050 }
[2020-01-28T22:30:55.883] [INFO] Sync - Synchronizer pid is 18220
[2020-01-28T22:30:55.901] [INFO] SyncServices - block_row.blocknum  4
[2020-01-28T22:30:58.200] [INFO] SyncPlatform - Updating the client network and other details to DB
[2020-01-28T22:30:58.209] [INFO] SyncServices - SyncServices.synchNetworkConfigToDB client  first-network  channel_name  mychannel
[2020-01-28T22:30:58.241] [INFO] FabricClient -  FabricClient.discover_results  endpoint  { host: 'orderer.example.com', port: 7050 }

【问题讨论】:

    标签: node.js hyperledger-fabric blockchain hyperldger-fabric-peer


    【解决方案1】:

    所以,我找到了问题的答案—— 奇怪的问题是它到处都显示它在 localhost:8080 上提供服务,但经过大量研究发现 node js 无法提供超级账本资源管理器在端口 8080 上的静态页面。 因此,需要使用“服务”来构建和服务该页面。两天前我就这样做了,它从端口 5000 和它自己的 IP 地址开始,但是由于违反 “控制安全策略”,我在网络浏览器上遇到错误。

    解决方案:

    $ cd ~/Hyperledger/blockchain-explorer/client
    $ npm install
    $ npm test -- -u --coverage 
    $ npm run build
    $ npm install -g serve
    $ serve -s build
    

    现在它会向你显示类似的输出:

    
       ┌────────────────────────────────────────────────────┐
       │                                                    │
       │   Serving!                                         │
       │                                                    │
       │   - Local:            http://localhost:5000        │
       │   - On Your Network:  http://160.33.244.178:5000   │
       │                                                    │
       │   Copied local address to clipboard!               │
       │                                                    │
       └────────────────────────────────────────────────────┘
    
    

    如果您打开:http://localhost:5000 它不会显示任何内容,并且在检查窗口的网络日志中会显示 - “控制安全策略违规”。

    所以像这样使用端口 8080:

    - Local:            http://localhost:8080        │
    - On Your Network:  http://160.33.244.178:8080
    

    另外,您需要启动 hyperldger explorer 服务器:

    $ cd ~/<YourPath>/blockchain-explorer
    $ ./start.sh
    

    您将看到选择了第一个网络的登录页面。

    使用:

    "adminUser" is the the admin user of the network, in this case it's fabric CA or an identity user.
    "adminPassword" is the password for the admin user.
    

    你在!

    【讨论】:

      【解决方案2】:

      如果您使用 docker compose 启动资源管理器,即位于 repo 的根目录中,则检查您的 8090 端口,导致 docker 将容器的 8080 端口映射到您机器的 8090 端口。

      github:hyperledger/blockain-explorer/docker-compose.yaml

      【讨论】:

      • 感谢您的回复!我没有使用 docker-compose 启动应用程序。我使用了 ./start.sh 我可以看到一个带有“Cannot GET /”的空白页面,但我可以在 doc-api 上看到 swagger spec doc 此外,在端口列表中,超级账本资源管理器被列为使用端口 8080。我可以看到数据库正在更新,但应用程序无法获得任何外观。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-09-09
      • 1970-01-01
      • 2018-09-13
      • 1970-01-01
      • 2013-07-16
      • 1970-01-01
      • 2014-01-26
      相关资源
      最近更新 更多