问题
Having recently upgraded to Corda 4.0 we are now seeing a serialization exception when trying to create transactions:
[ERROR] 10:09:49,500 [Mock network] amqp.SerializationOutput. - Serialization failed direction="Serialize", type="net.corda.core.transactions.TraversableTransaction", msg="Defined getter for parameter commands returns type java.util.List> yet underlying type is java.util.List>", ClassChain="net.corda.core.transactions.TraversableTransaction" {actor_id=Only For Testing, actor_owning_identity=O=Supplier 1, L=London, C=GB, actor_store_id=TEST, fiber-id=10000001, flow-id=e61b7da7-6826-4410-9414-1c03bebbc3fe, invocation_id=58c5f5ff-09f8-4bfa-bbe5-cf6b0ef47d06, invocation_timestamp=2019-03-28T10:09:46.205Z, origin=Only For Testing, session_id=58c5f5ff-09f8-4bfa-bbe5-cf6b0ef47d06, session_timestamp=2019-03-28T10:09:46.205Z, thread-id=400}
Any ideas what causes this?
回答1:
Anytime you see an error message of this form on Corda 4:
Defined getter for parameter [parameter name] returns type [type] yet underlying type is [exactly the same type]
It's caused by a bug in certain versions of Guava.
Corda 4 uses Guava version 25.1-jre
. However, if your node loads another version of Guava (e.g. 21.0
) that overrides Corda's version of Java, you will see this error.
A fix is planned for Corda 4.1.
回答2:
I faced this issue as well after upgrade to 4.0. My flows returned transaction as output and I've got TraversableTransaction serialization exception. I didn't solved it. I've created flow response DTO with all appropriated data, trxId etc...
Example:
SignedTransaction signedTransaction = subFlow(new FinalityFlow(signedTx, session));
response.setTrxId(signedTransaction.getId().toString());
return response;
来源:https://stackoverflow.com/questions/55400626/corda-4-0-transaction-serialization-issue