fabric-samples icon indicating copy to clipboard operation
fabric-samples copied to clipboard

fabric 2.4 invoke asset-transfer-basic/chaincode-java got "Undefined contract called"

Open weiminw opened this issue 3 years ago • 2 comments

I follow the tutorial:

run "./network.sh up createChannel" run "./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-java -ccl java -cci InitLedger"

then got error:

Error: endorsement failure during invoke. response: status:500 message:"Undefined contract called" 截屏2022-04-18 11 32 21

weiminw avatar Apr 18 '22 03:04 weiminw

anyone can help me

weiminw avatar Apr 23 '22 01:04 weiminw

@weiminw On the example it does not mention to add -cci initLedger, please have a look here: https://hyperledger-fabric.readthedocs.io/en/latest/write_first_app.html or on https://github.com/hyperledger/fabric-samples/tree/main/asset-transfer-basic, section Running the sample, step 2. BTW if you have a look in the ticket I have raised: https://github.com/hyperledger/fabric-samples/issues/747 the issue will be another for this example.

sgroh avatar May 18 '22 20:05 sgroh

I believe your error is due to using the --isInit flag when invoking the transaction function. The legacy intialisation mechanism is deprecated and its use is discouraged.

I don't see exactly the error as you but, using Fabric v3.0.0 and the --isInit flag for the peer chaincode invoke command, I get this error:

Error: endorsement failure during invoke. response: status:500 message:"error in simulation: failed to execute transaction 9d847bfdd3012b5bb571cc6da3096c0d95401ec5bb1bc287c1286ee6de4c9103: invalid invocation: chaincode 'basic' does not require initialization but called as init"

Running exactly the same command but with the --isInit flag removed, the invocation is successful.

bestbeforetoday avatar Jan 10 '25 17:01 bestbeforetoday