我收到以下错误net.corda.core.CordaRuntimeException:java.io.NotSerializableException:节点未找到com.example.state.TradeState,请检查包含实现com.example.state的CorDapp的Node。 TradeState已加载并位于类路径上。
我正在将cordapp作为systemd服务运行。这是错误的图像和我的节点目录结构
答案 0 :(得分:0)
这可能是由多个构造函数引起的问题。当您在Corda(Java版)中覆盖构造函数时,需要将@ConstructorForDeserialization
放在具有更多参数的构造函数上。另外,您还需要手动创建所有吸气剂(用于数据库休眠)。
@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;
}