Corda类org.hibernate.exception.SQLGrammarException没有注释或在白名单上,因此不能在序列化中使用

时间:2018-07-25 05:30:10

标签: corda

当我尝试为我的自定义状态查询Vault时,出现以下错误。 我的网络中有3个节点(节点1连接到sql server数据库,其他节点连接到h2数据库)。查询库时,节点1上引发以下错误。 (rpcOps.vaultQueryBy()。states)

  

javax.servlet.ServletException:javax.servlet.ServletException:   com.esotericsoftware.kryo.KryoException:类   org.hibernate.exception.SQLGrammarException没有注释或没有   白名单,因此不能在序列化中使用序列化跟踪:   异常(net.corda.core.utilities.Try $ Failure)           在org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146)   〜[jetty-server-9.4.7.v20170914.jar:9.4.7.v20170914]           在org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)   〜[jetty-server-9.4.7.v20170914.jar:9.4.7.v20170914]           在org.eclipse.jetty.server.Server.handle(Server.java:561)〜[jetty-server-9.4.7.v20170914.jar:9.4.7.v20170914]           在org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:334)   [jetty-server-9.4.7.v20170914.jar:9.4.7.v20170914]           在org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)   [jetty-server-9.4.7.v20170914.jar:9.4.7.v20170914]           在org.eclipse.jetty.io.AbstractConnection $ ReadCallback.succeeded(AbstractConnection.java:279)   [jetty-io-9.4.7.v20170914.jar:9.4.7.v20170914]           在org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:104)   [jetty-io-9.4.7.v20170914.jar:9.4.7.v20170914]           在org.eclipse.jetty.io.ChannelEndPoint $ 2.run(ChannelEndPoint.java:124)   [jetty-io-9.4.7.v20170914.jar:9.4.7.v20170914]           在org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:247)   [jetty-util-9.4.7.v20170914.jar:9.4.7.v20170914]           在org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:140)   [jetty-util-9.4.7.v20170914.jar:9.4.7.v20170914]           在org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)   [jetty-util-9.4.7.v20170914.jar:9.4.7.v20170914]           在org.eclipse.jetty.util.thread.ReservedThreadExecutor $ ReservedThread.run(ReservedThreadExecutor.java:243)   [jetty-util-9.4.7.v20170914.jar:9.4.7.v20170914]           在org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:679)   [jetty-util-9.4.7.v20170914.jar:9.4.7.v20170914]           在org.eclipse.jetty.util.thread.QueuedThreadPool $ 2.run(QueuedThreadPool.java:597)   [jetty-util-9.4.7.v20170914.jar:9.4.7.v20170914]           在java.lang.Thread.run(Thread.java:748)[?:1.8.0_181]原因:javax.servlet.ServletException:   com.esotericsoftware.kryo.KryoException:类   org.hibernate.exception.SQLGrammarException没有注释或没有   白名单,因此不能在序列化中使用序列化跟踪:   异常(net.corda.core.utilities.Try $ Failure)           在org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:489)   〜[jersey-container-servlet-core-2.25.jar :?]           在org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427)   〜[jersey-container-servlet-core-2.25.jar :?]           在org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388)   〜[jersey-container-servlet-core-2.25.jar :?]           在org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341)   〜[jersey-container-servlet-core-2.25.jar :?]           在org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228)   〜[jersey-container-servlet-core-2.25.jar :?]           在org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:841)   〜[jetty-servlet-9.4.7.v20170914.jar:9.4.7.v20170914]           在org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:535)   〜[jetty-servlet-9.4.7.v20170914.jar:9.4.7.v20170914]           在org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)   〜[jetty-server-9.4.7.v20170914.jar:9.4.7.v20170914]           在org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1253)   〜[jetty-server-9.4.7.v20170914.jar:9.4.7.v20170914]           在org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)   〜[jetty-server-9.4.7.v20170914.jar:9.4.7.v20170914]           在org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)   〜[jetty-servlet-9.4.7.v20170914.jar:9.4.7.v20170914]           在org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)   〜[jetty-server-9.4.7.v20170914.jar:9.4.7.v20170914]           在org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1155)   〜[jetty-server-9.4.7.v20170914.jar:9.4.7.v20170914]           在org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)   〜[jetty-server-9.4.7.v20170914.jar:9.4.7.v20170914]           在org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:126)   〜[jetty-server-9.4.7.v20170914.jar:9.4.7.v20170914]           ...另外14个

1 个答案:

答案 0 :(得分:0)

Corda限制了可以通过RPC在节点和客户端之间发送的类型集。

就您而言,您的流程抛出了fwrite(DT,"DT.csv",encoding = "UTF-8") Error in fwrite(DT, "DT.csv", encoding = "UTF-8") : unused argument (encoding = "UTF-8") 。节点正在尝试通过RPC将对象传递回客户端,但是由于它不是可以通过RPC传递的类型之一,因此引发了SQLGrammarException

您需要使用https://docs.corda.net/serialization.html#whitelisting所述的过程,将KryoException添加到节点的序列化白名单中。完成此操作后,SQLGrammarException将正确返回,您可以对其进行检查。