尝试对其中一个流程进行单元测试,但出现有关序列化的错误。在对流程进行单元测试时出现此错误。当我调用CollectSignaturesFlow并为其他必需的签署方创建的流会话列表时,会抛出该错误。
流代码
...
// Verifying the transaction.
txBuilder.verify(getServiceHub());
// Signing the transaction.
SignedTransaction signedTx = getServiceHub().signInitialTransaction(txBuilder);
// Create sessions with all required signers
List<FlowSession> flowSessions = new ArrayList<>();
for (Party party : requiredSignerParties) {
flowSessions.add(initiateFlow(party));
}
// Obtain all required signer parties' signatures.
SignedTransaction fullySignedTx = subFlow(new CollectSignaturesFlow(
signedTx, flowSessions));
// ^^ Error thrown
// Finalising the transaction.
SignedTransaction finalTx = subFlow(new FinalityFlow(fullySignedTx));
return finalTx;
错误在下面。
com.esotericsoftware.kryo.KryoException: java.lang.UnsupportedOperationException
Serialization trace:
dataObject (co.paralleluniverse.fibers.Stack)
stack (net.corda.node.services.statemachine.FlowStateMachineImpl)
at com.esotericsoftware.kryo.serializers.ObjectField.read(ObjectField.java:144)
at com.esotericsoftware.kryo.serializers.CompatibleFieldSerializer.read(CompatibleFieldSerializer.java:147)
at com.esotericsoftware.kryo.Kryo.readObjectOrNull(Kryo.java:782)
at co.paralleluniverse.io.serialization.kryo.ReplaceableObjectKryo.readObjectOrNull(ReplaceableObjectKryo.java:107)
at com.esotericsoftware.kryo.serializers.ObjectField.read(ObjectField.java:132)
at com.esotericsoftware.kryo.serializers.FieldSerializer.read(FieldSerializer.java:540)
at co.paralleluniverse.fibers.Fiber$FiberSerializer.read(Fiber.java:2137)
at co.paralleluniverse.fibers.Fiber$FiberSerializer.read(Fiber.java:2067)
at com.esotericsoftware.kryo.Kryo.readClassAndObject(Kryo.java:813)
at co.paralleluniverse.io.serialization.kryo.ReplaceableObjectKryo.readClassAndObject(ReplaceableObjectKryo.java:112)
at net.corda.nodeapi.internal.serialization.kryo.AbstractKryoSerializationScheme$deserialize$$inlined$use$lambda$1$1.invoke(KryoSerializationScheme.kt:97)
at net.corda.nodeapi.internal.serialization.kryo.AbstractKryoSerializationScheme$deserialize$$inlined$use$lambda$1$1.invoke(KryoSerializationScheme.kt:37)
at net.corda.nodeapi.internal.serialization.kryo.AbstractKryoSerializationScheme.withContext(KryoSerializationScheme.kt:80)
at net.corda.nodeapi.internal.serialization.kryo.AbstractKryoSerializationScheme.access$withContext(KryoSerializationScheme.kt:37)
at net.corda.nodeapi.internal.serialization.kryo.AbstractKryoSerializationScheme$deserialize$$inlined$use$lambda$1.execute(KryoSerializationScheme.kt:95)
at com.esotericsoftware.kryo.pool.KryoPoolQueueImpl.run(KryoPoolQueueImpl.java:61)
at net.corda.nodeapi.internal.serialization.kryo.AbstractKryoSerializationScheme.deserialize(KryoSerializationScheme.kt:94)
at net.corda.nodeapi.internal.serialization.SerializationFactoryImpl$deserialize$1$1.invoke(SerializationScheme.kt:111)
at net.corda.core.serialization.SerializationFactory.withCurrentContext(SerializationAPI.kt:66)
at net.corda.nodeapi.internal.serialization.SerializationFactoryImpl$deserialize$1.invoke(SerializationScheme.kt:111)
at net.corda.nodeapi.internal.serialization.SerializationFactoryImpl$deserialize$1.invoke(SerializationScheme.kt:86)
at net.corda.core.serialization.SerializationFactory.asCurrent(SerializationAPI.kt:80)
at net.corda.nodeapi.internal.serialization.SerializationFactoryImpl.deserialize(SerializationScheme.kt:111)
at net.corda.node.services.statemachine.StateMachineManagerImpl.deserializeFiber(StateMachineManagerImpl.kt:709)
at net.corda.node.services.statemachine.StateMachineManagerImpl.access$deserializeFiber(StateMachineManagerImpl.kt:63)
at net.corda.node.services.statemachine.StateMachineManagerImpl$updateCheckpoint$2.run(StateMachineManagerImpl.kt:547)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.UnsupportedOperationException
at java.util.AbstractCollection.add(AbstractCollection.java:262)
at com.esotericsoftware.kryo.serializers.CollectionSerializer.read(CollectionSerializer.java:134)
at com.esotericsoftware.kryo.serializers.CollectionSerializer.read(CollectionSerializer.java:40)
at com.esotericsoftware.kryo.Kryo.readObject(Kryo.java:731)
at co.paralleluniverse.io.serialization.kryo.ReplaceableObjectKryo.readObject(ReplaceableObjectKryo.java:92)
at com.esotericsoftware.kryo.serializers.DefaultArraySerializers$ObjectArraySerializer.read(DefaultArraySerializers.java:392)
at com.esotericsoftware.kryo.serializers.DefaultArraySerializers$ObjectArraySerializer.read(DefaultArraySerializers.java:303)
at com.esotericsoftware.kryo.Kryo.readObject(Kryo.java:731)
[INFO ] 19:15:46,205 [Mock node 1 thread] (FetchDataFlow.kt:75) flow.[6b2a80f6-e525-4461-ab37-4498a57d90f2].call - Requesting 1 dependency(s) for verification from O=Parent Company, L=London, C=GB {}
at co.paralleluniverse.io.serialization.kryo.ReplaceableObjectKryo.readObject(ReplaceableObjectKryo.java:92)
at com.esotericsoftware.kryo.serializers.ObjectField.read(ObjectField.java:125)
... 28 more