Skip to content

May org.json.JSONObject used in org.hyperledger.fabric.contract.execution.JSONTransactionSerializer lead submit payloads not matching? #361

Description

@8f235831

When I call a submit method from application via gateway, I received an Exception below.

Caused by: org.hyperledger.fabric.client.EndorseException: io.grpc.StatusRuntimeException: ABORTED: failed to collect enough transaction endorsements, see attached details for more info
at org.hyperledger.fabric.client.GatewayClient.endorse(GatewayClient.java:74)
at org.hyperledger.fabric.client.ProposalImpl.endorse(ProposalImpl.java:76)
at org.hyperledger.fabric.client.Proposal.endorse(Proposal.java:64)
at pers.u8f23.fabric.app.api.AbstractAssetContractSubmit.createAsset(AbstractAssetContractSubmit.java:13)
at pers.u8f23.fabric.app.Main.chaincodeOperations(Main.java:84)
at pers.u8f23.fabric.app.Main.main(Main.java:65)
Caused by: io.grpc.StatusRuntimeException: ABORTED: failed to collect enough transaction endorsements, see attached details for more info
at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:268)
at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:249)
at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:167)
at org.hyperledger.fabric.protos.gateway.GatewayGrpc$GatewayBlockingStub.endorse(GatewayGrpc.java:455)
at org.hyperledger.fabric.client.GatewayClient.endorse(GatewayClient.java:72)
... 5 more

Detail message attached to this Exception is ProposalResponsePayloads do not match.

Returned type is a generic class. Both the generic type and the type argument are defined as type in fabric demo .

publicinterfaceAbstractAssetContractSubmit {
Response<Asset> createAsset(Contextcontext, Stringvalue);
Response<Void> deleteAsset(Contextcontext, StringassetId);
Response<Void> updateAsset(Contextcontext, StringassetId, Stringvalue);
}
@DataTypepublicfinalclassResponse<T> {
@PropertyprivatefinalTbody;
@Propertyprivatefinalintcode;
@PropertyprivatefinalStringmsg;
publicResponse(@JsonProperty("body") Tbody, @JsonProperty("code") intcode,
@JsonProperty("msg") Stringmsg) {
this.body = body;
this.code = code;
this.msg = msg;
}
publicTgetBody() {
returnthis.body;
}
publicintgetCode() {
returnthis.code;
}
publicStringgetMsg() {
returnthis.msg;
}
}
@DataTypepublicfinalclassAsset {
@PropertyprivatefinalStringid;
@PropertyprivatefinalStringcreatorId;
@PropertyprivatefinalStringownerId;
@PropertyprivatefinallongcreateTime;
@PropertyprivatefinallonglastTransferTime;
@PropertyprivatefinallonglastUpdateTime;
@PropertyprivatefinalStringassetValue;
publicAsset(@JsonProperty("id") Stringid, @JsonProperty("creatorId") StringcreatorId,
@JsonProperty("ownerId") StringownerId, @JsonProperty("createTime") longcreateTime,
@JsonProperty("lastTransferTime") longlastTransferTime,
@JsonProperty("lastUpdateTime") longlastUpdateTime,
@JsonProperty("assetValue") StringassetValue) {
this.id = id;
this.creatorId = creatorId;
this.ownerId = ownerId;
this.createTime = createTime;
this.lastTransferTime = lastTransferTime;
this.lastUpdateTime = lastUpdateTime;
this.assetValue = assetValue;
}
publicStringgetId() {
returnthis.id;
}
publicStringgetCreatorId() {
returnthis.creatorId;
}
publicStringgetOwnerId() {
returnthis.ownerId;
}
publiclonggetCreateTime() {
returnthis.createTime;
}
publiclonggetLastTransferTime() {
returnthis.lastTransferTime;
}
publiclonggetLastUpdateTime() {
returnthis.lastUpdateTime;
}
publicStringgetAssetValue() {
returnthis.assetValue;
}
}

Does this chaincode api support java generic type as method return type?
Anyone is welcome to answer this question.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions