2017-07-26 57 views
0

下面的教程在这里时出现错误。“错误尝试调用链式代码错误:链式代码错误(状态:500,消息:TypeError:无法读取属性'getFullyQualifiedIdentifier'为空)”,

https://hyperledger.github.io/composer/unstable/managing/current-participant.html

我已经创建了一个参与者,并颁发的身份吧。但是在我的事务处理函数中,当我通过使用getCurrentParticipant函数通过rest apis来验证当前参与者的参与者ID时,我得到以下错误。

{ “错误”:{ “的StatusCode”:500, “名”: “错误”, “消息”:“错误试图调用chaincode错误:chaincode错误(状态:500,消息: TypeError:无法读取属性'getFullyQualifiedIdentifier'为空)“, ”stack“:”错误:错误尝试调用chaincode错误:chaincode错误(状态:500,消息:TypeError:无法读取属性'getFullyQualifiedIdentifier'为null)\ n at _initializeChannel.then.then.then.then.then.catch(/home/praval/.nvm/versions/node/v6.11.1/lib/node_modules/composer-rest-server/node_modules/composer-connector-hlfv1/lib/ hlfconnection.js:847:34)“ } }

有人可以解释原因吗?

回答

0

它看起来像从证书到参与者的映射不到位。最简单的测试方法是使用composer identity issue命令,然后使用composer network ping - 这将返回当前的参与者。一旦这个工作,然后getCurrentParticipant()应该工作。

https://hyperledger.github.io/composer/managing/identity-issue.html

当你composer network ping您的参与者将试图访问网络的元数据。下面的ACL规则将允许此访问。请确保您使用的是包含此规则的最新版本的基本样本网络。

rule SystemACL { 
    description: "System ACL to permit all access" 
    participant: "org.hyperledger.composer.system.Participant" 
    operation: ALL 
    resource: "org.hyperledger.composer.system.**" 
    action: ALLOW 
} 
+0

谢谢丹。但是,当运行ping commnad时,会出现以下错误。 作曲家网络ping -n'basic-sample-network'-i parth -s pAAqPGvWVdoP 错误:尝试查询链式代码时发生错误。错误:链接代码错误(状态:500,消息:错误:参与者'org.acme.sample.SampleParticipant#parth'没有'READ'访问资源'org.hyperledger.composer.system.Network#basic-sample-network @ 0.1.1') –

+0

有趣的是,ACL引擎将访问网络元数据本身限制在您的参与者身上。要打开它,您可以编辑网络中的ACL文件。详情请参阅答案。 –

+0

我正在使用belwo acl文件..它对我来说似乎很好。 规则AllAccess { 描述: “AllAccess - 授予的一切给大家” 参与者: “org.acme.sample.SampleParticipant” 操作:ALL 资源: “org.acme.sample **” 操作:允许 } –