首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >超级分类账编写器V0.12部署失败

超级分类账编写器V0.12部署失败
EN

Stack Overflow用户
提问于 2017-09-06 12:22:13
回答 1查看 111关注 0票数 0

使用HyperledgerComposerV0.12使用以下代码调用deploy函数,这将返回一个“成功”结果:

代码语言:javascript
运行
复制
/**
 * Deploys a new BusinessNetworkDefinition to the Hyperledger Fabric. The connection must be connected for this method to succeed.
 * @param {express.req} req - the inbound request object from the client
 *  req.body.myArchive: _string - string name of object
 *  req.body.deployOptions: _object - string name of object
 * @param {express.res} res - the outbound response object for communicating back to client
 * @param {express.next} next - an express service to enable post processing prior to responding to the client
 * returns composerAdmin.connection - either an error or a connection object
 * @function
 */
exports.deploy = function(req, res, next) {

let newFile = path.join(path.dirname(require.main.filename),'network/dist',req.body.myArchive);
let archiveFile = fs.readFileSync(newFile);

let adminConnection = new composerAdmin.AdminConnection();

return BusinessNetworkDefinition.fromArchive(archiveFile)
    .then(function(archive) {
        adminConnection.connect(config.composer.connectionProfile, config.composer.adminID, config.composer.adminPW)
        .then(function(){
            adminConnection.deploy(archive)
                .then(function(){
                    console.log('business network '+req.body.myArchive+' deployed successful: ');
                    res.send({deploy: req.body.myArchive+' deploy succeeded'});
                })
                .catch(function(error){
                    console.log('business network '+req.body.myArchive+' deploy failed: ',error);
                    res.send({deploy: error});
                    });
            });
        });
};

但是,当我介绍以下过程时:

  1. 启动停靠映像,使用cli部署网络
  2. ping
  3. 取消部署
  4. ping
  5. 部署
  6. ping

我得到以下结果:

代码语言:javascript
运行
复制
[2] at: 08:10:36.058 Url is: /composer/admin/ping
network ping successful:  { version: '0.12.0', participant: null }
[3] at: 08:11:05.503 Url is: /composer/admin/undeploy
zerotoblockchain-network network undeploy successful 
[4] at: 08:11:25.186 Url is: /composer/admin/ping
(node:18241) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Error trying to ping. Error: Error trying to query chaincode. Error: chaincode error (status: 500, message: Error: The business network has been undeployed)
[5] at: 08:11:34.393 Url is: /composer/admin/deploy
business network zerotoblockchain-network.bna deployed successful: 
[6] at: 08:11:44.211 Url is: /composer/admin/ping
(node:18241) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: Error trying to ping. Error: Error trying to query chaincode. Error: chaincode error (status: 500, message: Error: The business network has been undeployed)

这表明composer部署函数实际上并没有部署网络,尽管我似乎从部署服务收到了成功的完成消息。救命求你了?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-09-07 07:52:33

当您取消部署业务网络时,它所做的就是将业务网络标记为不可访问。它仍在部署并仍在运行。原因是目前Hyperledger fabric没有提供关闭实例化链码的机制。所以我们所能做的就是把它标记为不可用。deploy和命令是建立和运行业务网络的老方法。新方法是安装/启动组合。deploy成功的原因是,它必须对install命令报告的错误做出决定,才能继续以Hyperledger结构的预期方式工作。因此,尽管它报告了部署的成功,但它实际上什么也不做,因为它已经部署了。

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

https://stackoverflow.com/questions/46075129

复制
相关文章

相似问题

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