hyperledger / hyperledger/fabric-chaincode-java

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

オープン
#361 コメント 6 件 リアクション 0 件 担当者 0 名 GitHub で見る
bug help wanted
主要言語
Java
スター
323
フォーク
210
平均マージ
8時間 1分
マージ済み PR(30日)
8

説明

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 .
```java
public interface AbstractAssetContractSubmit {
Response createAsset(Context context, String value);

Response deleteAsset(Context context, String assetId);

Response updateAsset(Context context, String assetId, String value);
}
```
```java

@DataType
public final class Response {
@Property
private final T body;

@Property
private final int code;

@Property
private final String msg;

public Response(@JsonProperty("body") T body, @JsonProperty("code") int code,
@JsonProperty("msg") String msg) {
this.body = body;
this.code = code;
this.msg = msg;
}

public T getBody() {
return this.body;
}

public int getCode() {
return this.code;
}

public String getMsg() {
return this.msg;
}
}

```
```java

@DataType
public final class Asset {
@Property
private final String id;

@Property
private final String creatorId;

@Property
private final String ownerId;

@Property
private final long createTime;

@Property
private final long lastTransferTime;

@Property
private final long lastUpdateTime;

@Property
private final String assetValue;

public Asset(@JsonProperty("id") String id, @JsonProperty("creatorId") String creatorId,
@JsonProperty("ownerId") String ownerId, @JsonProperty("createTime") long createTime,
@JsonProperty("lastTransferTime") long lastTransferTime,
@JsonProperty("lastUpdateTime") long lastUpdateTime,
@JsonProperty("assetValue") String assetValue) {
this.id = id;
this.creatorId = creatorId;
this.ownerId = ownerId;
this.createTime = createTime;
this.lastTransferTime = lastTransferTime;
this.lastUpdateTime = lastUpdateTime;
this.assetValue = assetValue;
}

public String getId() {
return this.id;
}

public String getCreatorId() {
return this.creatorId;
}

public String getOwnerId() {
return this.ownerId;
}

public long getCreateTime() {
return this.createTime;
}

public long getLastTransferTime() {
return this.lastTransferTime;
}

public long getLastUpdateTime() {
return this.lastUpdateTime;
}

public String getAssetValue() {
return this.assetValue;
}
}
```

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

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。