简体   繁体   中英

Hyperledger composer v0.16.2 Rest server error

I am working composer v0.16.2. I am having an error while I try to reconnect to composer-rest-server.

I am using this command:

composer-rest-server -c admin@mynetwork -n always -a true -m true -w true -t true -e /home /.nvm/versions/node/v8.9.3/lib/node_modules/composer-rest-server/cert.pem -k /home /.nvm/versions/node/v8.9.3/lib/node_modules/composer-rest-server/key.pem

Whatever the option I set it works fine first time but when I need to reconnect with the same command, I need to restart fabric and deploy the business network again otherwise it will show this error:

Discovering types from business network definition ...
Connection fails:
Error: Error trying to ping.
Error: Error trying to query business network.
Error: Connect Failed It will be retried for the next request.
Exception: Error: Error trying to ping.
Error: Error trying to query business network.
Error: Connect Failed Error: Error trying to ping.
Error: Error trying to query business network.
Error: Connect Failed at _checkRuntimeVersions.then.catch (/home/.../.nvm/versions/node/v8.9.1/lib/node_modules/composer-rest-server/node_modules/composer-connector-hlfv1/lib/hlfconnection.js:713:34)
                      at <anonymous>

Hyperledger Composer v0.16.0 network start error

I found a similar question on this link but I need to start fabric again when this error comes and again deploying network archive help to start the rest server.

My question is how can I remove this error without starting fabric again when I need to start rest server?

The first action of the REST server is to 'Discover' the Business Network using the admin@mynetwork Card. So you can simplify testing here by not using the REST server, but by issuing a simpler command composer network ping -c admin@mynetwork or composer network list -c admin@mynetwork .

When your admin@mynetwork card is created (when you deploy the business network), then imported BEFORE you use it try the command composer card list --name admin@mynetwork - at the bottom of the output you should see:

secretSet: Secret set credentialsSet: Credentials not set

After you use the card for the first time with a composer network ping or list, redo the composer card list --name admin@mynetwork and you should see a change in the output with Credentials set .

This is important because when the Card is created, it is created with a One Time secret, and when it is first used the Certificates are downloaded - Credentials Set. The problem you are seeing with a failure of the REST server the second time you use it suggests that the certificates needed for the second use are not present.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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