尝试从Corda V1迁移到V3 . 它在V1中运行良好,但在使用Corda V3之后,其投掷低于错误 -
java.util.concurrent.ExecutionException:java.io.NotSerializableException:net.corda.core.contracts.TransactionState - > data(net.corda.core.contracts.ContractState) - >参数qualifiedBurrency的定义setter接受类型接口的参数java.util.List但是底层类型是java.util.List - > java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)atjava.util.concurrent.CompletableFuture中的类com.xxx.agreementnegotiation.state.AgreementNegotiationState .get(CompletableFuture.java:1895)at the net.corda.core.internal.concurrent.CordaFutureImpl.get(CordaFutureImpl.kt)at com.xxx.agreementnegotiation.api.AgreementNegotiationApi.startInitFlow(AgreementNegotiationApi.java:95)at sun . 在sun.reflect.NalMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)的sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)的java.lang.reflect.Method.invoke上的reflect.NativeMethodAccessorImpl.invoke0(Native Method) Method.java:498)at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory $ 1.invoke(ResourceMethodInvocationHandlerFactory.java:81)org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher $ 1.run(AbstractJavaResourceMethodDispatcher.java:144)at org . 在org.glassfish的org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider $ ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:160)的glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161) . 位于org.glassfish.jersey.server.model的org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389)的jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99) . 在org.glassfish.jersey.server.model.ResourceMethodInvoker.apply的ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347)(ResourceMethodInvoker.java:102 )org.glassfish.jersey.server.ServerRuntime $ 2.run(ServerRuntime.java:326)org.glassfish.jersey.internal.Errors $ 1.call(Errors.java:271)org.glassfish.jersey.internal . 在org.glassfish.jersey.internal.Errors.process(Errors.java:297)的org.glassfish.jersey.internal.Errors.process(Errors.java:315)错误$ 1.call(Errors.java:267)at org.glassfish.jersey.internal.Errors.process(Errors.java:267)org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)org.glassfish.jersey.server.ServerRuntime . 进程(ServerRuntime.java:305)org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)位于org.glassfish的org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473) .gersey.servlet.WebComponent.service(WebComponent.java:427)org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388)org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java) :341)在org.glassfish.jersey . servlet.ServletContainer.service(ServletContainer.java:228)org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:841)org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:535) org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)org.eclipse.jetty.server.andHandle(ContextHandler.java:1253)org.eclipse.jetty.server上的org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188) .handler.ScopedHandler.nextScope(ScopedHandler.java:168)org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java) :166)在org.eclipse上的org.eclipse.jetty.server.hand.ScpedHandler.handle(ScopedHandler.java:141)的org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1155) . 在org.eclipse.jetty.server.Server的org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)的jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:126) .handle(Server.java:561)org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:334)org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)at atg.eclipse.jetty.server.HttpChannel.handleOrg.eclipse.jetty.io.AbstractConnection $ ReadCallback.succeeded(AbstractConnection.java:279)org.eclipse.jetty.FillInterest.fillable(FillInterest.java:104)org.eclipse.jetty.io.ChannelEndPoint $ 2 .run(ChannelEndPoint.java:124)org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:247)org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill) .java:140)atg.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)org.eclipse.jetty.util.thread.ReservedThreadExecutor $ ReservedThread.run(ReservedThreadExecutor.java:243 )org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:679)at org.eclipse.jetty.util.thread.QueuedThreadPool $ 2.run(QueuedThreadPool.java:597)at java.lang.Thread .run(Thread.java:748)引起:java.io.NotSerializableException:net.corda.core.contracts.TransactionState - > data(net.corda.core.contracts.ContractState) - >为参数qualifiedCurrency定义的setter接受类型接口java.util.List的参数但是底层类型是java.util.List - > class com.xxx.agreementnegotiation.state.AgreementNegotiationState
我国的某些部分
public class AgreementNegotiationState extends AgreementStateTemplate implements QueryableState {
private String baseCurrency;
private List<String> eligibleCurrency;
private int deliveryAmount;
public String getBaseCurrency() {
return baseCurrency;
}
public void setBaseCurrency(String baseCurrency) {
this.baseCurrency = baseCurrency;
}
public List<String> getEligibleCurrency() {
return eligibleCurrency;
}
public void setEligibleCurrency(List<String> eligibleCurrency) {
this.eligibleCurrency = eligibleCurrency;
}
public int getDeliveryAmount() {
return deliveryAmount;
}
public void setDeliveryAmount(int deliveryAmount) {
this.deliveryAmount = deliveryAmount;
}
}
请协助 .
2 回答
这是Corda 3中的一个错误 . 它将在Corda 4中修复 .
与此同时,解决方法是将
eligibleCurrency
更改为List<?>
,并根据需要强制转换元素:根据corda V3,集合是不可变的,因此您无法添加到现有集合 . 解决方案是创建一个函数,该函数获取现有集合的副本并在其中添加项目,最后将其引用到qualifiedCurrency列表 .
我希望,这是有道理的