在Linux服务器“ net.corda.core.CordaRuntimeException”上运行cordapp时遇到此错误

时间:2019-04-11 05:05:44

标签: linux corda

我收到以下错误net.corda.core.CordaRuntimeException:java.io.NotSerializableException:节点未找到com.example.state.TradeState,请检查包含实现com.example.state的CorDapp的Node。 TradeState已加载并位于类路径上。

我正在将cordapp作为systemd服务运行。这是错误的图像和我的节点目录结构

enter image description here

enter image description here

1 个答案:

答案 0 :(得分:0)

这可能是由多个构造函数引起的问题。当您在Corda(Java版)中覆盖构造函数时,需要将@ConstructorForDeserialization放在具有更多参数的构造函数上。另外,您还需要手动创建所有吸气剂(用于数据库休眠)。

这里是一个示例:https://github.com/corda/samples-java/blob/master/Accounts/tictacthor/contracts/src/main/java/com/tictacthor/states/BoardState.java

@ConstructorForDeserialization
public BoardState(UniqueIdentifier playerO, UniqueIdentifier playerX,
                  AnonymousParty me, AnonymousParty competitor,
                  boolean isPlayerXTurn, UniqueIdentifier linearId,
                  char[][] board, Status status) {
    this.playerO = playerO;
    this.playerX = playerX;
    this.me = me;
    this.competitor = competitor;
    this.isPlayerXTurn = isPlayerXTurn;
    this.linearId = linearId;
    this.board = board;
    this.status = status;
}