简体   繁体   English

在超级账本结构中动态执行交易时出错

[英]Error while executing the transaction dynamically in hyperledger fabric

I have modified the fabcar example to execute in a particular time interval.我修改了 fabcar 示例以在特定时间间隔内执行。 It works fine upto 4th or 5th times.它可以正常工作第 4 次或第 5 次。 Then it start showing error like this.然后它开始显示这样的错误。

2020-02-24T10:33:09.018Z - warn: [Query]: evaluate: Query ID "[object Object]" of peer "peer1.org1.example.com:8051" failed: message=cannot retrieve package for chaincode fabcar/1.0, error open /var/hyperledger/production/chaincodes/fabcar.1.0: no such file or directory, stack=Error: cannot retrieve package for chaincode fabcar/1.0, error open /var/hyperledger/production/chaincodes/fabcar.1.0: no such file or directory
    at self._endorserClient.processProposal (/home/djaxtech/fabric-samples/fabcar/javascript/node_modules/fabric-client/lib/Peer.js:140:36)
    at Object.onReceiveStatus (/home/djaxtech/fabric-samples/fabcar/javascript/node_modules/grpc/src/client_interceptors.js:1207:9)
    at InterceptingListener._callNext (/home/djaxtech/fabric-samples/fabcar/javascript/node_modules/grpc/src/client_interceptors.js:568:42)
    at InterceptingListener.onReceiveStatus (/home/djaxtech/fabric-samples/fabcar/javascript/node_modules/grpc/src/client_interceptors.js:618:8)
    at callback (/home/djaxtech/fabric-samples/fabcar/javascript/node_modules/grpc/src/client_interceptors.js:845:24), status=500, , url=grpcs://localhost:8051, name=peer1.org1.example.com:8051, grpc.max_receive_message_length=-1, grpc.max_send_message_length=-1, grpc.keepalive_time_ms=120000, grpc.http2.min_time_between_pings_ms=120000, grpc.keepalive_timeout_ms=20000, grpc.http2.max_pings_without_data=0, grpc.keepalive_permit_without_calls=1, name=peer1.org1.example.com:8051, grpc.ssl_target_name_override=peer1.org1.example.com, grpc.default_authority=peer1.org1.example.com, isProposalResponse=true
Failed to evaluate transaction: Error: cannot retrieve package for chaincode fabcar/1.0, error open /var/hyperledger/production/chaincodes/fabcar.1.0: no such file or directory

Tried the answer from this link Querying chaincode is only successful in ~3/5 cases with nodejs .尝试了此链接中的答案查询链码仅在使用 nodejs 的 ~3/5 情况下成功 But I could not able to install the chaincode in peer1 through CLI container.但是我无法通过 CLI 容器在 peer1 中安装链码。 Facing error like this.面对这样的错误。

Error: error getting endorser client for install: endorser client failed to connect to peer1.org1.example.com:7051: failed to create new connection: connection error: desc = "transport: error while dialing: dial tcp 172.23.0.11:7051: connect: connection refused"

How to resolve?如何解决?

It has been cleared by installing chaincode in both the peers.它已通过在两个对等方中安装链码来清除。 Here I am giving code snippet to install the chaincode via ./startFabric.sh在这里,我提供了通过 ./startFabric.sh 安装链码的代码片段

Installation in peer1 0f Organisation 1安装在 peer1 0f 组织 1

echo "Installing smart contract on peer1.org1.example.com"
docker exec \
  -e CORE_PEER_LOCALMSPID=Org1MSP \
  -e CORE_PEER_ADDRESS=peer1.org1.example.com:8051 \
  -e CORE_PEER_MSPCONFIGPATH=${ORG1_MSPCONFIGPATH} \
  -e CORE_PEER_TLS_ROOTCERT_FILE=${ORG1_TLS_ROOTCERT_FILE} \
  cli \
  peer chaincode install \
    -n fabcar \
    -v 1.0 \
    -p "$CC_SRC_PATH" \
    -l "$CC_RUNTIME_LANGUAGE"

Installation in peer1 of organisation 2在组织 2 的 peer1 中安装

echo "Installing smart contract on peer1.org2.example.com"
docker exec \
  -e CORE_PEER_LOCALMSPID=Org2MSP \
  -e CORE_PEER_ADDRESS=peer1.org2.example.com:10051 \
  -e CORE_PEER_MSPCONFIGPATH=${ORG2_MSPCONFIGPATH} \
  -e CORE_PEER_TLS_ROOTCERT_FILE=${ORG2_TLS_ROOTCERT_FILE} \
  cli \
  peer chaincode install \
    -n fabcar \
    -v 1.0 \
    -p "$CC_SRC_PATH" \
    -l "$CC_RUNTIME_LANGUAGE"

In Invoke initLedger()在调用 initLedger()

docker exec \
  -e CORE_PEER_LOCALMSPID=Org1MSP \
  -e CORE_PEER_MSPCONFIGPATH=${ORG1_MSPCONFIGPATH} \
  cli \
  peer chaincode invoke \
    -o orderer.example.com:7050 \
    -C mychannel \
    -n fabcar \
    -c '{"function":"initLedger","Args":[]}' \
    --waitForEvent \
    --tls \
    --cafile ${ORDERER_TLS_ROOTCERT_FILE} \
    --peerAddresses peer0.org1.example.com:7051 \
    --peerAddresses peer1.org1.example.com:8051 \
    --peerAddresses peer0.org2.example.com:9051 \
    --peerAddresses peer1.org2.example.com:10051 \
    --tlsRootCertFiles ${ORG1_TLS_ROOTCERT_FILE} \
    --tlsRootCertFiles ${ORG1_TLS_ROOTCERT_FILE} \
    --tlsRootCertFiles ${ORG2_TLS_ROOTCERT_FILE} \
    --tlsRootCertFiles ${ORG2_TLS_ROOTCERT_FILE}

Then start the ./startFabric.sh.然后启动./startFabric.sh。 It will work!它会起作用!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 部署自定义链码时出现 Hyperledger 结构错误 - Hyperledger fabric error while deploying a custom chaincode 在超级账本结构中使用节点 js sdk 时出错? - Error while using node js sdk in hyperledger fabric? 使用节点 SDK 在超级账本结构中注册和注册时遇到错误 - facing error while enroll and register in hyperledger fabric using node SDK 超级账本结构中的商业票据中没有交易数据 - No transaction data in commercial-paper in hyperledger fabric Hyperledger Fabric 1.2功能错误 - Hyperledger fabric 1.2 capabilities error 未能成功调用错误 eventthub 出现问题错误:14 UNAVAILABLE: Connect Failed --while invoking in hyperledger fabric - Failed to invoke successfully Error There was a problem with the eventhub Error: 14 UNAVAILABLE: Connect Failed --while invoking in hyperledger fabric Hyperledger Fabric Node.js SDK:离线交易签名问题 - Hyperledger Fabric Node.js SDK: Issue with offline transaction signatures Hyperledger Composer / fabric中的主数据和交易数据关系 - Master data and transaction data relations in hyperledger composer/fabric Hyperledger Fabric - 无法调用交易 - 背书失败 - Hyperledger Fabric - Cannot invoke a transaction - Endorsement has failed Hyperledger Fabric:如何使用 JS/Node 中的链码捕获交易错误? - Hyperledger Fabric: How to catch transaction errors with chaincode in JS/Node?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM