- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试运行 Contract 的 corda-bootcamp 测试用例。我按照视频中给出的方式进行操作,但是当尝试运行契约(Contract)测试时 - 我收到错误
java.io.NotSerializableException: data(net.corda.core.contracts.ContractState) -> Trying to build an object serializer for bootcamp.TokenState, but it is not constructible from its public properties, and so requires a custom serialiser.
有人可以帮忙吗,如何解决这个问题?我发现了类似的问题 - here ,但这没有用。
下面是使用的Tokenstate,
package bootcamp;
import com.google.common.collect.ImmutableList;
import net.corda.core.contracts.BelongsToContract;
import net.corda.core.contracts.ContractState;
import net.corda.core.identity.AbstractParty;
import net.corda.core.identity.Party;
import java.util.ArrayList;
import java.util.List;
/* Our state, defining a shared fact on the ledger.
* See src/main/java/examples/ArtState.java for an example. */
@BelongsToContract(TokenContract.class)
public class TokenState implements ContractState {
private Party issuer;
private Party owner;
private int amount;
public TokenState(Party issuer, Party owner, int amount) {
this.issuer = issuer;
this.owner = owner;
this.amount = amount;
}
public Party getIssuer() {
return issuer;
}
public Party getOwner() {
return owner;
}
public int getAmount() {
return amount;
}
public List<AbstractParty> getParticipants() {
List<AbstractParty> participants = new ArrayList<>();
participants.add(issuer);
participants.add(owner);
return participants;
}
}
抛出错误的测试用例,
private final TestIdentity alice = new TestIdentity(new CordaX500Name("Alice", "", "GB"));
private final TestIdentity bob = new TestIdentity(new CordaX500Name("Bob", "", "GB"));
private MockServices ledgerServices = new MockServices(new TestIdentity(new CordaX500Name("TestId", "", "GB")));
private TokenState tokenState = new TokenState(alice.getParty(), bob.getParty(), 1);
@Test
public void tokenContractRequiresZeroInputsInTheTransaction() {
transaction(ledgerServices, tx -> {
// Has an input, will fail.
tx.input(TokenContract.ID, tokenState);
tx.output(TokenContract.ID, tokenState);
tx.command(Arrays.asList(alice.getPublicKey(), bob.getPublicKey()), new TokenContract.Commands.Issue());
tx.fails();
return null;
});
transaction(ledgerServices, tx -> {
// Has no input, will verify.
tx.output(TokenContract.ID, tokenState);
tx.command(Arrays.asList(alice.getPublicKey(), bob.getPublicKey()), new TokenContract.Commands.Issue());
tx.verifies();
return null;
});
}
最佳答案
Corda 使用自己的序列化框架,该框架要求 Java 编译器在生成字节码时保留参数名称,以便稍后可以正确地重新创建对象。
要使其与 IntelliJ 配合使用,请执行以下操作:
打开设置:
转到构建、执行、部署 -> 编译器 -> Java 编译器在“附加命令行参数”字段中写入 -parameters
关于java - 如何解决 bootcamp-cordapp 中的 NotSerializedException。测试合约时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58033294/
每当我尝试在模拟器上运行以下计算器应用程序时,它都会立即崩溃。不懂Java,看logcat有点吃力。 该程序的目的是创建一个重量转换应用程序,该应用程序使用单选组并将千克转换为磅,反之亦然。 这是我的
我目前正在开发一个用 WPF (C#) 编写的 Windows 应用程序,我希望仅当该应用程序在通过 Bootcamp 运行 Windows 的 Apple 计算机上运行时才启用某些功能。我没有在任何
bootcamp中安装windows后,弹出错误 Windows failed to start. A recent hardware or software change might be the
我经常在 Mac Pro (e2008) (Mac Os X 10.5.6) 的 bootcamp 分区上重新启动 Windows。因为我喜欢用重新启动的时间来做其他事情,而不是只是坐着,所以我想编写
我只是尝试使用任务调度程序在 python 中运行测试脚本,为此我需要创建一个 .bat 文件以使其能够运行。这是当前的bat文件: "C:\Program Files (x86)\Python38
我正在使用 qz-tray(一种中间件,通过连接在客户端计算机 USB 端口上的打印机从浏览器进行打印)来打印我的 POS 收据。我使用 PostScriptPrinting 来生成收据,对于 Pos
我正在尝试运行 Contract 的 corda-bootcamp 测试用例。我按照视频中给出的方式进行操作,但是当尝试运行契约(Contract)测试时 - 我收到错误 java.io.NotSer
刚刚购买了一台 2.4GHz Intel Core 2 Duo iMac,配备 2GB 内存和 320GB 硬盘。我计划使用 BootCamp/VMWare 组合对其进行一些 .net 开发,因为 V
标题几乎概括了它。我会将 VS2010 用于 SilverLight、WPF、Windows Phone 7 等。我只是想知道是否存在任何编译问题,或者您在 PC 上看不到的潜在错误,或者您能想到的。
我是一名 .Net 开发人员,使用 Bootcamp 在 2010 MacPro(2.27Ghz/6GB RAM)上运行 Windows 7 Ultimate (x64)。直到大约一个月前,imo 还
我是一名优秀的程序员,十分优秀!