当前位置: 首页 > 知识库问答 >
问题:

Hyperledger:成功部署chaincode。但是,不能查询-说ResourceNotFound

荀豪
2023-03-14

我已经用docker Compose启动了一个peer和membersrvc容器。他们已经成功地开始了。我从CLI部署example02 chaincode(也尝试了REST)。我得到一个成功的信息。当我试图查询chaincode时,我在查询chaincode时得到错误:

错误:未能启动chaincode规范(无法获取mycc-ledgererror-resourceNotfound的部署事务:ledger:找不到资源)

下面是我执行的步骤:

[karthik@localhost hyperledger]$ cat docker-compose.yml
membersrvc:
  image: hyperledger/fabric-membersrvc
  ports:
    - "7054:7054"
  command: membersrvc
vp0:
  image: hyperledger/fabric-peer
  ports:
    - "7050:7050"
    - "7051:7051"
    - "7053:7053"
  environment:
    - CORE_PEER_ADDRESSAUTODETECT=true
    - CORE_VM_ENDPOINT=unix:///var/run/docker.sock
    - CORE_LOGGING_LEVEL=DEBUG
    - CORE_PEER_ID=vp0
    - CORE_PEER_PKI_ECA_PADDR=membersrvc:7054
    - CORE_PEER_PKI_TCA_PADDR=membersrvc:7054
    - CORE_PEER_PKI_TLSCA_PADDR=membersrvc:7054
    - CORE_SECURITY_ENABLED=true
    - CORE_SECURITY_ENROLLID=test_vp0
    - CORE_SECURITY_ENROLLSECRET=MwYpmSRjupbT
  links:
    - membersrvc
  command: sh -c "sleep 5; peer node start --peer-chaincodedev"
[karthik@localhost hyperledger]$ docker images
REPOSITORY                      TAG                 IMAGE ID                CREATED             SIZE
hyperledger/fabric-membersrvc   latest              b3654d32e4f9        5     weeks ago         1.417 GB
hyperledger/fabric-peer         latest              21cb00fb27f4        5     weeks ago         1.423 GB
hello-world                     latest              c54a2cc56cbb        4     months ago        1.848 kB
[karthik@localhost hyperledger]$ docker-compose up -d
Creating hyperledger_membersrvc_1
Creating hyperledger_vp0_1
[karthik@localhost hyperledger]$ docker ps
CONTAINER ID        IMAGE                           COMMAND                  CREATED             STATUS                   PORTS                                                      NAMES
14b223d73370        hyperledger/fabric-peer         "sh -c 'sleep 5;   peer"   8 seconds ago       Up 4 seconds        0.0.0.0:7050-7051->7050-7051/tcp, 0.0.0.0:7053->7053/tcp   hyperledger_vp0_1
88ab8858c170        hyperledger/fabric-membersrvc   "membersrvc"             11 seconds ago      Up 7 seconds        0.0.0.0:7054->7054/tcp                                     hyperledger_membersrvc_1

完成上述操作并通过registrar进行用户登录后,我使用以下有效负载执行了/chaincode rest:

{
  "jsonrpc": "2.0",
  "method": "deploy",
  "params": {
    "type": 1,
    "chaincodeID":{
        "path":"github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02",
         "name" : "mycc"
    },
    "ctorMsg": {
        "args":["init", "a", "1000", "b", "2000"]
    },
    "secureContext": "lukas"
  },
  "id": 1
}
{
        "jsonrpc": "2.0",
        "result":
        {
            "status": "OK",
            "message": "mycc"
        },
        "id": 1
    }
{
  "jsonrpc": "2.0",
  "method": "query",
  "params": {
      "type": 1,
      "chaincodeID":{
          "name":"mycc"
      },
      "ctorMsg": {
         "args":["query", "a"]
      },
      "secureContext": "lukas"
  },
  "id": 5
}
{
        "jsonrpc": "2.0",
        "error":
        {
            "code": -32003,
            "message": "Query failure",
            "data": "Error when querying chaincode: Error:Failed to launch chaincode spec(Could not get deployment transaction for mycc - LedgerError - ResourceNotFound: ledger: resource not found)"
        },
        "id": 5
    }
13:19:00.894 [rest] processChaincodeDeploy -> INFO cb6 Successfully deployed chainCode: mycc
13:19:00.895 [rest] ProcessChaincode -> INFO cb7 REST successfully deploy chaincode: {"jsonrpc":"2.0","result":{"status":"OK","message":"mycc"},"id":1}
13:19:01.454 [consensus/noops] handleChannels -> DEBU cb8 Process block due to time
13:19:01.454 [consensus/noops] processTransactions -> DEBU cb9 Starting TX batch with timestamp: seconds:1479820741 nanos:454455273 
13:19:01.454 [consensus/noops] processTransactions -> DEBU cba Executing batch of 1 transactions with timestamp seconds:1479820741 nanos:454455273 
13:19:01.454 [crypto] Debugf -> DEBU cbb [validator.test_vp0] Tx confdential level [PUBLIC].
13:19:01.454 [chaincode] Deploy -> DEBU cbc user runs chaincode, not deploying chaincode
13:19:01.454 [state] TxBegin -> DEBU cbd txBegin() for txId [mycc]
13:19:01.454 [chaincode] sendInitOrReady -> DEBU cbe handler not found for chaincode mycc
13:19:01.454 [chaincode] Launch -> ERRO cbf sending init failed(handler not found for chaincode mycc)
13:19:01.454 [container] lockContainer -> DEBU cc0 waiting for container(dev-vp0-mycc) lock
13:19:01.454 [container] lockContainer -> DEBU cc1 got container (dev-vp0-mycc) lock
13:19:01.455 [dockercontroller] stopInternal -> DEBU cc2 Stop container dev-vp0-mycc(Post http://unix.sock/containers/dev-vp0-mycc/stop?t=0: dial unix /var/run/docker.sock: connect: no such file or directory)
13:19:01.455 [dockercontroller] stopInternal -> DEBU cc3 Kill container dev-vp0-mycc (Post http://unix.sock/containers/dev-vp0-mycc/kill: dial unix /var/run/docker.sock: connect: no such file or directory)
13:19:01.456 [dockercontroller] stopInternal -> DEBU cc4 Remove container dev-vp0-mycc (dial unix /var/run/docker.sock: connect: no such file or directory)
13:19:01.456 [container] unlockContainer -> DEBU cc5 container lock deleted(dev-vp0-mycc)
13:19:01.456 [chaincode] Launch -> DEBU cc6 sending init completed
13:19:01.456 [chaincode] Launch -> DEBU cc7 LaunchChaincode complete
13:19:01.456 [state] TxFinish -> DEBU cc8 txFinish() for txId [mycc], txSuccessful=[false]
13:19:01.456 [state] GetHash -> DEBU cc9 Enter - GetHash()
13:19:01.456 [buckettree] ComputeCryptoHash -> DEBU cca Enter - ComputeCryptoHash()
13:19:01.456 [buckettree] ComputeCryptoHash -> DEBU ccb Returing existing crypto-hash as recomputation not required
13:19:01.456 [state] GetHash -> DEBU ccc Exit - GetHash()
13:19:01.456 [consensus/noops] processTransactions -> DEBU ccd Committing TX batch with timestamp: seconds:1479820741 nanos:454455273 
13:19:01.456 [state] GetHash -> DEBU cce Enter - GetHash()
13:19:01.456 [buckettree] ComputeCryptoHash -> DEBU ccf Enter - ComputeCryptoHash()
13:19:01.456 [buckettree] ComputeCryptoHash -> DEBU cd0 Returing existing crypto-hash as recomputation not required
13:19:01.456 [state] GetHash -> DEBU cd1 Exit - GetHash()
13:19:01.456 [indexes] addIndexDataForPersistence -> DEBU cd2 Indexing block number [3] by hash = [feb273eff4ac3611f6fa3d71a0c7e7d49b3728b436e445b77dcd3529c209c9621771cb39f04f9ace636af1693c33bcd61a360edce9a1a520085915e301200fe0]
13:19:01.456 [state] AddChangesForPersistence -> DEBU cd3 state.addChangesForPersistence()...start
13:19:01.456 [state] AddChangesForPersistence -> DEBU cd4 Adding state-delta corresponding to block number[3]
13:19:01.456 [state] AddChangesForPersistence -> DEBU cd5 Not deleting previous state-delta. Block number [3] is smaller than historyStateDeltaSize [500]
13:19:01.456 [state] AddChangesForPersistence -> DEBU cd6 state.addChangesForPersistence()...finished
13:19:01.456 [ledger] resetForNextTxGroup -> DEBU cd7 resetting ledger state for next transaction batch
13:19:01.456 [buckettree] ClearWorkingSet -> DEBU cd8 Enter - ClearWorkingSet()
13:19:01.456 [ledger] CommitTxBatch -> DEBU cd9 There were some erroneous transactions. We need to send a 'TX rejected' message here.
13:19:01.457 [consensus/handler] CommitTxBatch -> DEBU cda Committed block with 0 transactions, intended to include 0
13:19:01.457 [consensus/noops] getBlockData -> DEBU cdb Preparing to broadcast with block number 4
13:19:01.457 [consensus/noops] getBlockData -> DEBU cdc Got the delta state of block number 4
13:19:01.457 [consensus/noops] notifyBlockAdded -> DEBU cdd Broadcasting Message_SYNC_BLOCK_ADDED to non-validators

我很确定部署失败了。有人能帮忙修一下吗?

共有1个答案

贺海
2023-03-14

问题(来自日志记录)是拨号unix/var/run/docker.sock:connect:没有这样的文件或目录您需要将/var/run/docker.sock挂载到您的docker容器

volumes
  - /var/run/docker.sock:/var/run/docker.sock

链接到UNIX///var/run/docker.sock的每个节点

 类似资料:
  • 我在Openshift上运行node.js应用时遇到了问题。 我已经设置了我的 openshift 项目来从 git 存储库中提取。 我的< code>server.listen调用如下: 拉取和构建工作正常。我可以在pod终端中看到我的应用程序正在运行,因为有一些输出指示这一点。我还可以看到和都不存在,因此端口默认为。 如果我进入pod的终端并执行< code > curl http://loc

  • 我有一个由3个orgs和两个频道组成的网络。

  • 在和中,哪种语言在维护性、可伸缩性和更好的支持方面更适合“链式代码”开发?

  • 问题内容: 我正在尝试使用逗号分隔值列表创建联接。例如: 应该: 我正在尝试使用。但是,使用下面的代码,我得到了。我注意到了sql-server的语法,但是对于我们的配置而言,它看起来并不可行。这是我的查询: 问题答案: 我认为要使您的查询正常工作,您需要添加一个,然后更改。您还应该使用适当的显式连接语法: 或者,可能要在结果中包括其他属性:

  • 我在这里讨论一下文档:https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-storage-blob-output?tabs=python 以下是我目前掌握的代码: function.json 初始化。py 如果我理解正确,当一个Blob被添加到容器中时,这个函数应该被触发,并且它可以在同一个容器中保存该

  • composer network deploy实用程序用于将业务网络档案从本地磁盘部署到Hyperledger Fabric v1.0网络。在使用此命令之前,请阅读部署和更新业务网络文档。 composer network deploy -a digitalPropertyNetwork.bna -A admin -S -c PeerAdmin@hlfv1 -f admincard 选项 com