error in chaincode execution


famar
 

Hi all, I am having problems running chaincode during caliper testing. I have confidence that my chaincode is correct since I created an app with the JAVA sdk and I can both write and read from the ledger via the appropriate transactions.  The error that caliper gives me is as follows:

 

Failed to perform submit transaction [createClinicalDocument] using arguments [0_0, testHash, "here i have a complex string generated by an XML document"]

with error: EndorseError: 10 ABORTED: failed to endorse transaction, see attached details for more info

Details:

-  peer0.org1.example.com:7051:chaincode response 500, Error during contract method execution

This is the log of the peer:

Thread[fabric-txinvoke:1,5,main] 08:53:03:191 INFO    org.hyperledger.fabric.contract.ContractRouter processRequest                    Got routing:createClinicalDocument:org.example.PatientSummaryUpdateContract

Thread[fabric-txinvoke:3,5,main] 08:53:03:202 SEVERE  org.hyperledger.fabric.Logger error                                              Error during contract method executionorg.hyperledger.fabric.contract.ContractRuntimeException: Error during contract method execution

at org.hyperledger.fabric.contract.execution.impl.ContractExecutionService.executeRequest(ContractExecutionService.java:79)

at org.hyperledger.fabric.contract.ContractRouter.processRequest(ContractRouter.java:123)

at org.hyperledger.fabric.contract.ContractRouter.invoke(ContractRouter.java:134)

at org.hyperledger.fabric.shim.impl.ChaincodeInvocationTask.call(ChaincodeInvocationTask.java:106)

at org.hyperledger.fabric.shim.impl.InvocationTaskManager.lambda$newTask$17(InvocationTaskManager.java:265)

at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1736)

at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)

at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)

at java.base/java.lang.Thread.run(Thread.java:834)

Caused by: java.lang.NullPointerException

at org.example.PatientSummaryUpdateContract.createClinicalDocument(PatientSummaryUpdateContract.java:194)

at jdk.internal.reflect.GeneratedMethodAccessor15.invoke(Unknown Source)

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.base/java.lang.reflect.Method.invoke(Method.java:566)

at org.hyperledger.fabric.contract.execution.impl.ContractExecutionService.executeRequest(ContractExecutionService.java:61)

... 8 more

.. caused by ..nulljava.lang.NullPointerException

at org.example.PatientSummaryUpdateContract.createClinicalDocument(PatientSummaryUpdateContract.java:194)

at jdk.internal.reflect.GeneratedMethodAccessor15.invoke(Unknown Source)

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.base/java.lang.reflect.Method.invoke(Method.java:566)

at org.hyperledger.fabric.contract.execution.impl.ContractExecutionService.executeRequest(ContractExecutionService.java:61)

at org.hyperledger.fabric.contract.ContractRouter.processRequest(ContractRouter.java:123)

at org.hyperledger.fabric.contract.ContractRouter.invoke(ContractRouter.java:134)

at org.hyperledger.fabric.shim.impl.ChaincodeInvocationTask.call(ChaincodeInvocationTask.java:106)

at org.hyperledger.fabric.shim.impl.InvocationTaskManager.lambda$newTask$17(InvocationTaskManager.java:265)

at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1736)

at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)

at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)

at java.base/java.lang.Thread.run(Thread.java:834)

 

Thread[fabric-txinvoke:3,5,main] 08:53:03:202 SEVERE  org.hyperledger.fabric.shim.impl.ChaincodeInvocationTask call                    [6c24afbc] Invoke failed with error code 500. Sending ERROR

Thread[fabric-txinvoke:5,5,main] 08:53:03:209 SEVERE  org.hyperledger.fabric.Logger error                                              Error during contract method executionorg.hyperledger.fabric.contract.ContractRuntimeException: Error during contract method execution

at org.hyperledger.fabric.contract.execution.impl.ContractExecutionService.executeRequest(ContractExecutionService.java:79)

at org.hyperledger.fabric.contract.ContractRouter.processRequest(ContractRouter.java:123)

at org.hyperledger.fabric.contract.ContractRouter.invoke(ContractRouter.java:134)

at org.hyperledger.fabric.shim.impl.ChaincodeInvocationTask.call(ChaincodeInvocationTask.java:106)

at org.hyperledger.fabric.shim.impl.InvocationTaskManager.lambda$newTask$17(InvocationTaskManager.java:265)

at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1736)

at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)

at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)

at java.base/java.lang.Thread.run(Thread.java:834)

Caused by: java.lang.NullPointerException

at org.example.PatientSummaryUpdateContract.createClinicalDocument(PatientSummaryUpdateContract.java:194)

at jdk.internal.reflect.GeneratedMethodAccessor15.invoke(Unknown Source)

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.base/java.lang.reflect.Method.invoke(Method.java:566)

at org.hyperledger.fabric.contract.execution.impl.ContractExecutionService.executeRequest(ContractExecutionService.java:61)

... 8 more

.. caused by ..nulljava.lang.NullPointerException

at org.example.PatientSummaryUpdateContract.createClinicalDocument(PatientSummaryUpdateContract.java:194)

at jdk.internal.reflect.GeneratedMethodAccessor15.invoke(Unknown Source)

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.base/java.lang.reflect.Method.invoke(Method.java:566)

at org.hyperledger.fabric.contract.execution.impl.ContractExecutionService.executeRequest(ContractExecutionService.java:61)

at org.hyperledger.fabric.contract.ContractRouter.processRequest(ContractRouter.java:123)

at org.hyperledger.fabric.contract.ContractRouter.invoke(ContractRouter.java:134)

at org.hyperledger.fabric.shim.impl.ChaincodeInvocationTask.call(ChaincodeInvocationTask.java:106)

at org.hyperledger.fabric.shim.impl.InvocationTaskManager.lambda$newTask$17(InvocationTaskManager.java:265)

at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1736)

at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)

at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)

at java.base/java.lang.Thread.run(Thread.java:834)

 

Thread[fabric-txinvoke:5,5,main] 08:53:03:210 SEVERE  org.hyperledger.fabric.shim.impl.ChaincodeInvocationTask call                    [823aacac] Invoke failed with error code 500. Sending ERROR

Thread[fabric-txinvoke:2,5,main] 08:53:03:210 SEVERE  org.hyperledger.fabric.Logger error                                              Error during contract method executionorg.hyperledger.fabric.contract.ContractRuntimeException: Error during contract method execution

at org.hyperledger.fabric.contract.execution.impl.ContractExecutionService.executeRequest(ContractExecutionService.java:79)

at org.hyperledger.fabric.contract.ContractRouter.processRequest(ContractRouter.java:123)

at org.hyperledger.fabric.contract.ContractRouter.invoke(ContractRouter.java:134)

at org.hyperledger.fabric.shim.impl.ChaincodeInvocationTask.call(ChaincodeInvocationTask.java:106)

at org.hyperledger.fabric.shim.impl.InvocationTaskManager.lambda$newTask$17(InvocationTaskManager.java:265)

at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1736)

at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)

at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)

at java.base/java.lang.Thread.run(Thread.java:834)

Caused by: java.lang.NullPointerException

at org.example.PatientSummaryUpdateContract.createClinicalDocument(PatientSummaryUpdateContract.java:194)

at jdk.internal.reflect.GeneratedMethodAccessor15.invoke(Unknown Source)

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.base/java.lang.reflect.Method.invoke(Method.java:566)

at org.hyperledger.fabric.contract.execution.impl.ContractExecutionService.executeRequest(ContractExecutionService.java:61)

... 8 more

.. caused by ..nulljava.lang.NullPointerException

at org.example.PatientSummaryUpdateContract.createClinicalDocument(PatientSummaryUpdateContract.java:194)

at jdk.internal.reflect.GeneratedMethodAccessor15.invoke(Unknown Source)

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.base/java.lang.reflect.Method.invoke(Method.java:566)

at org.hyperledger.fabric.contract.execution.impl.ContractExecutionService.executeRequest(ContractExecutionService.java:61)

at org.hyperledger.fabric.contract.ContractRouter.processRequest(ContractRouter.java:123)

at org.hyperledger.fabric.contract.ContractRouter.invoke(ContractRouter.java:134)

at org.hyperledger.fabric.shim.impl.ChaincodeInvocationTask.call(ChaincodeInvocationTask.java:106)

at org.hyperledger.fabric.shim.impl.InvocationTaskManager.lambda$newTask$17(InvocationTaskManager.java:265)

at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1736)

at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)

at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)

at java.base/java.lang.Thread.run(Thread.java:834)

 

Thread[fabric-txinvoke:2,5,main] 08:53:03:212 SEVERE  org.hyperledger.fabric.shim.impl.ChaincodeInvocationTask call                    [4e1c0fa5] Invoke failed with error code 500. Sending ERROR

Thread[fabric-txinvoke:1,5,main] 08:53:03:215 SEVERE  org.hyperledger.fabric.Logger error                                              Error during contract method executionorg.hyperledger.fabric.contract.ContractRuntimeException: Error during contract method execution

at org.hyperledger.fabric.contract.execution.impl.ContractExecutionService.executeRequest(ContractExecutionService.java:79)

at org.hyperledger.fabric.contract.ContractRouter.processRequest(ContractRouter.java:123)

at org.hyperledger.fabric.contract.ContractRouter.invoke(ContractRouter.java:134)

at org.hyperledger.fabric.shim.impl.ChaincodeInvocationTask.call(ChaincodeInvocationTask.java:106)

at org.hyperledger.fabric.shim.impl.InvocationTaskManager.lambda$newTask$17(InvocationTaskManager.java:265)

at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1736)

at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)

at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)

at java.base/java.lang.Thread.run(Thread.java:834)

Caused by: java.lang.NullPointerException

at org.example.PatientSummaryUpdateContract.createClinicalDocument(PatientSummaryUpdateContract.java:194)

at jdk.internal.reflect.GeneratedMethodAccessor15.invoke(Unknown Source)

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.base/java.lang.reflect.Method.invoke(Method.java:566)

at org.hyperledger.fabric.contract.execution.impl.ContractExecutionService.executeRequest(ContractExecutionService.java:61)

... 8 more

.. caused by ..nulljava.lang.NullPointerException

at org.example.PatientSummaryUpdateContract.createClinicalDocument(PatientSummaryUpdateContract.java:194)

at jdk.internal.reflect.GeneratedMethodAccessor15.invoke(Unknown Source)

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.base/java.lang.reflect.Method.invoke(Method.java:566)

at org.hyperledger.fabric.contract.execution.impl.ContractExecutionService.executeRequest(ContractExecutionService.java:61)

at org.hyperledger.fabric.contract.ContractRouter.processRequest(ContractRouter.java:123)

at org.hyperledger.fabric.contract.ContractRouter.invoke(ContractRouter.java:134)

at org.hyperledger.fabric.shim.impl.ChaincodeInvocationTask.call(ChaincodeInvocationTask.java:106)

at org.hyperledger.fabric.shim.impl.InvocationTaskManager.lambda$newTask$17(InvocationTaskManager.java:265)

at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1736)

at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)

at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)

at java.base/java.lang.Thread.run(Thread.java:834)

 

Thread[fabric-txinvoke:1,5,main] 08:53:03:215 SEVERE  org.hyperledger.fabric.shim.impl.ChaincodeInvocationTask call                    [a1a085a9] Invoke failed with error code 500. Sending ERROR

Thread[fabric-txinvoke:3,5,main] 08:53:03:227 INFO    org.hyperledger.fabric.contract.ContractRouter processRequest                    Got invoke routing request

Thread[fabric-txinvoke:3,5,main] 08:53:03:228 INFO    org.hyperledger.fabric.contract.ContractRouter processRequest                    Got the invoke request for:createClinicalDocument [0_0, testHash,"same string as before"]

 


Attila Klenik
 

Hi there!

This error originates from your chaincode (a null pointer exception, based on the logs) that results in a failed endorsement. Caliper just reports this fact.
Try to add more logging and input checks to your chaincode to identify the location of the error. You could use the [0_0, testHash, "here i have a complex string generated by an XML document"] arguments as a test input for debugging this problem.

Anyway, the Caliper side cannot cause this behavior (which is a chaincode bug), Caliper just provides the inputs based on your workload module.

Best Regards,
Attila Klenik