Question

As I understand, GridGain 6 has some customized serialization and also utlizes H2 for various purposes.

We use H2 as a serialized object store. For instance, here is the relevant part of a table schema.

CREATE TABLE IF NOT EXISTS QUEUE (ID IDENTITY PRIMARY KEY, OBJECT OTHER NOT NULL ....)

When attempting to insert a row, I get the following error. The last few lines indicate that the GridH2IndexingSpi is configured and is failing on something (even though my test isn't running on the Grid). I couldn't easily debug further since the spi source and my debugger seem out of sync and the line numbers are meaningless.

From what I was able to debug in Utils.java, It appears that the gridgain serializer has been configured in H2 (statically !!!!) and is being used.

Any thoughts on how to resolve or avoid this situation? I've tried various H2 versions such as 1.3.176 (which gridgain uses) and the newer 1.4.177, but as expected, they don't make any difference since the issue is with the use the indexing spi.

I can try and create a small H2 / Gridgain project project to illustrate the issue, if that would help.

Thanks

Exception in thread "pool-4-thread-1"  org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL []; SQL state [90026]; error code [90026]; Serialization failed, cause: "java.lang.NullPointerException"; SQL statement:
INSERT INTO QUEUE (OBJECT....) VALUES (?,?,?,?) [90026-170]; nested exception is org.h2.jdbc.JdbcSQLException: Serialization failed, cause: "java.lang.NullPointerException"; SQL statement:
INSERT INTO QUEUE (OBJECT, ....) VALUES (?,?,?,?) [90026-170]
....
Caused by: org.h2.jdbc.JdbcSQLException: Serialization failed, cause: "java.lang.NullPointerException"; SQL statement:
INSERT INTO QUEUE (OBJECT, ....) VALUES (?,?,?,?) [90026-170]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
at org.h2.message.DbException.get(DbException.java:158)
....
Caused by: java.lang.NullPointerException
at org.gridgain.grid.spi.indexing.h2.GridH2IndexingSpi.access$100(GridH2IndexingSpi.java:145)
at org.gridgain.grid.spi.indexing.h2.GridH2IndexingSpi$1.serialize(GridH2IndexingSpi.java:201)
at org.h2.util.Utils.serialize(Utils.java:273)
... 27 more
Was it helpful?

Solution

I finally understood what's happening. At the point when GridGain H2 integration was implemented, H2 had only one static serializer. That's why GridGain is using a static property. As a possible workaround for the problem can you try setting in your H2 database your custom serializer which will in fact utilize usual H2 serialization?

Latest H2 version supports specifying per-database serializer and GridGain will fix that in upcoming version.

OTHER TIPS

I am not sure what it is you are doing with H2, but you should not utilize the same H2 database as used by GridGain internally.

GridGain utilizes H2 internally exclusively for SQL indexing and querying capabilities.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top