1
votes

I get below error when i try to query vault for my custom state. I have 3 nodes, in my network (node 1 connected to sql server database and other nodes connected to h2 database). Below error is thrown on node 1 when querying the vault. (rpcOps.vaultQueryBy().states)

javax.servlet.ServletException: javax.servlet.ServletException: com.esotericsoftware.kryo.KryoException: Class org.hibernate.exception.SQLGrammarException is not annotated or on the whitelist, so cannot be used in serialization Serialization trace: exception (net.corda.core.utilities.Try$Failure) at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146) ~[jetty-server-9.4.7.v20170914.jar:9.4.7.v20170914] at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) ~[jetty-server-9.4.7.v20170914.jar:9.4.7.v20170914] at org.eclipse.jetty.server.Server.handle(Server.java:561) ~[jetty-server-9.4.7.v20170914.jar:9.4.7.v20170914] at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:334) [jetty-server-9.4.7.v20170914.jar:9.4.7.v20170914] at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251) [jetty-server-9.4.7.v20170914.jar:9.4.7.v20170914] at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279) [jetty-io-9.4.7.v20170914.jar:9.4.7.v20170914] at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:104) [jetty-io-9.4.7.v20170914.jar:9.4.7.v20170914] at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124) [jetty-io-9.4.7.v20170914.jar:9.4.7.v20170914] at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:247) [jetty-util-9.4.7.v20170914.jar:9.4.7.v20170914] at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:140) [jetty-util-9.4.7.v20170914.jar:9.4.7.v20170914] at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131) [jetty-util-9.4.7.v20170914.jar:9.4.7.v20170914] at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:243) [jetty-util-9.4.7.v20170914.jar:9.4.7.v20170914] at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:679) [jetty-util-9.4.7.v20170914.jar:9.4.7.v20170914] at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:597) [jetty-util-9.4.7.v20170914.jar:9.4.7.v20170914] at java.lang.Thread.run(Thread.java:748) [?:1.8.0_181] Caused by: javax.servlet.ServletException: com.esotericsoftware.kryo.KryoException: Class org.hibernate.exception.SQLGrammarException is not annotated or on the whitelist, so cannot be used in serialization Serialization trace: exception (net.corda.core.utilities.Try$Failure) at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:489) ~[jersey-container-servlet-core-2.25.jar:?] at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427) ~[jersey-container-servlet-core-2.25.jar:?] at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388) ~[jersey-container-servlet-core-2.25.jar:?] at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341) ~[jersey-container-servlet-core-2.25.jar:?] at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228) ~[jersey-container-servlet-core-2.25.jar:?] at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:841) ~[jetty-servlet-9.4.7.v20170914.jar:9.4.7.v20170914] at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:535) ~[jetty-servlet-9.4.7.v20170914.jar:9.4.7.v20170914] at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188) ~[jetty-server-9.4.7.v20170914.jar:9.4.7.v20170914] at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1253) ~[jetty-server-9.4.7.v20170914.jar:9.4.7.v20170914] at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168) ~[jetty-server-9.4.7.v20170914.jar:9.4.7.v20170914] at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473) ~[jetty-servlet-9.4.7.v20170914.jar:9.4.7.v20170914] at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166) ~[jetty-server-9.4.7.v20170914.jar:9.4.7.v20170914] at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1155) ~[jetty-server-9.4.7.v20170914.jar:9.4.7.v20170914] at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) ~[jetty-server-9.4.7.v20170914.jar:9.4.7.v20170914] at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:126) ~[jetty-server-9.4.7.v20170914.jar:9.4.7.v20170914] ... 14 more

1
so in that case should when i add SQLGrammarException class in serialization whitelist, i now get further error for SQLServerException. sqlException (org.hibernate.exception.SQLGrammarException) Should i add the class in which code the to query vault is being written, into my serialization whitelist? - Dikshika Jain
Once you've whitelisted the exception, you'll see the "true" stack trace (unless another exception needs to be whitelisted). Once you have the "true" stack trace, we can diagnose the error (in a separate SO question). - Joel
Thanks, i;ll try that and get back if any issues - Dikshika Jain

1 Answers

1
votes

Corda restricts the set of types that can be sent between the node and a client via RPC.

In your case, your flow is throwing a SQLGrammarException. The node is trying to pass this object back to the client via RPC, but since it is not one of the types that can be passed via RPC, a KryoException is being raised instead.

You need to add SQLGrammarException to the node's serialisation whitelist, using the process described here: https://docs.corda.net/serialization.html#whitelisting. Once you've done this, the SQLGrammarException will be returned correctly and you can inspect it.