无法部署IBM Bluemix提供的Java链代码

时间:2017-06-13 09:48:46

标签: ibm-cloud blockchain hyperledger-fabric

来自restclient的请求:

POST http://localhost:7050/chaincode

请求:
    {       “jsonrpc”:“2.0”,       “方法”:“部署”,       “params”:{         “类型”:1,         “chaincodeID”:{             “名字”:“raja”         },         “ctorMsg”:{             “args”:[“init”,“a”,“100”,“b”,“200”]         }       },       “id”:5     }

使用chaincode id name注册java链代码:

rajasekhar@rajasekhar-VirtualBox:~/mychaincode/src/github.com/hyperledger/fabric/examples/chaincode/java/chaincode_example02/build/distributions/chaincode_example02/bin$ CORE_CHAINCODE_ID_NAME=raja  ./chaincode_example02
Jun 13, 2017 1:24:06 PM org.hyperledger.fabric.shim.ChaincodeBase newPeerClientConnection
INFO: Configuring channel connection to peer.
Jun 13, 2017 1:24:09 PM org.hyperledger.fabric.shim.ChaincodeBase chatWithPeer
INFO: Connecting to peer.
Jun 13, 2017 1:24:09 PM io.grpc.internal.TransportSet$1 call
INFO: Created transport io.grpc.netty.NettyClientTransport@599c4539(/127.0.0.1:7051) for /127.0.0.1:7051
Jun 13, 2017 1:24:10 PM io.grpc.internal.TransportSet$TransportListener transportReady
INFO: Transport io.grpc.netty.NettyClientTransport@599c4539(/127.0.0.1:7051) for /127.0.0.1:7051 is ready
Jun 13, 2017 1:24:10 PM org.hyperledger.fabric.shim.ChaincodeBase chatWithPeer
INFO: Registering as 'raja' ... sending REGISTER
java.lang.RuntimeException: [raja]Chaincode handler org.hyperledger.fabric.shim.fsm cannot handle message (INIT) with payload size (23) while in state: established
    at org.hyperledger.fabric.shim.impl.Handler.handleMessage(Handler.java:493)
    at org.hyperledger.fabric.shim.ChaincodeBase$1.onNext(ChaincodeBase.java:188)
    at org.hyperledger.fabric.shim.ChaincodeBase$1.onNext(ChaincodeBase.java:181)
    at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onMessage(ClientCalls.java:305)
    at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$2.runInContext(ClientCallImpl.java:423)
    at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:54)
    at io.grpc.internal.SerializingExecutor$TaskRunner.run(SerializingExecutor.java:154)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:748)

1 个答案:

答案 0 :(得分:0)

您需要提供有关目前为止所做工作的更多信息。只有错误信息 - 它无法确定失败的原因。

以下是有关如何为区块链编写Java链代码的优秀文档:https://www.ibm.com/developerworks/library/j-chaincode-for-java-developers/index.html

我希望你看过上面的文件。一个接一个地完成这些步骤。在将环境设置为用Java编写第一个链代码方面,文档非常广泛。

希望这会有所帮助。