我需要几个节点来建立一个事务。为此,我创建了一个TransactionBuilder
并将其传递给节点,然后将其状态添加到其中。
自official documentation提到[TransactionBuilder] is intended to be passed around contracts that may edit it by adding new states/commands.
但是,在运行单元测试时,网络会抛出此异常:
Class class net.corda.core.transactions.TransactionBuilder is not on the whitelist or annotated with @CordaSerializable.
java.io.NotSerializableException: Class class net.corda.core.transactions.TransactionBuilder is not on the whitelist or annotated with @CordaSerializable.
我曾尝试将TransactionBuilder
列入白名单,但这引发了这个问题:
net.corda.core.transactions.TransactionBuilder -> outputs(java.util.List<net.corda.core.contracts.TransactionState<net.corda.core.contracts.ContractState>>) -> java.util.List<net.corda.core.contracts.TransactionState<net.corda.core.contracts.ContractState>> -> net.corda.core.contracts.TransactionState<net.corda.core.contracts.ContractState> -> data(net.corda.core.contracts.ContractState) -> state(com.luxoft.poc.mobi.data.state.TransportAgreement$State) -> Class class com.luxoft.poc.mobi.data.state.TransportAgreement$State is not on the whitelist or annotated with @CordaSerializable.
java.io.NotSerializableException: net.corda.core.transactions.TransactionBuilder -> outputs(java.util.List<net.corda.core.contracts.TransactionState<net.corda.core.contracts.ContractState>>) -> java.util.List<net.corda.core.contracts.TransactionState<net.corda.core.contracts.ContractState>> -> net.corda.core.contracts.TransactionState<net.corda.core.contracts.ContractState> -> data(net.corda.core.contracts.ContractState) -> state(com.luxoft.poc.mobi.data.state.TransportAgreement$State) -> Class class com.luxoft.poc.mobi.data.state.TransportAgreement$State is not on the whitelist or annotated with @CordaSerializable.
我在做什么错?我该如何解决?
我们使用Corda 3.3
答案 0 :(得分:1)
根据错误消息,您还需要将TransportAgreement.State
添加到白名单中,因为它是作为事务构建器的一部分发送的。