Error 50000-210: org.h2.jdbc.JdbcSQLNonTransientException

853 views
Skip to first unread message

Jake Dunn

unread,
Apr 7, 2022, 7:01:06 PM4/7/22
to H2 Database
I'm getting an error, org.h2.jdbc.JdbcSQLNonTransientException: General error: "java.lang.NullPointerException", when trying to run an integration test that uses an H2 in-memory DB. The error only occurs with H2, not when running the same query against a Postgres instance. Any thoughts on resolving this issue?


 Caused by: java.lang.NullPointerException    at org.h2.command.query.Query.getParameterValues(Query.java:449)    at org.h2.command.query.Query.exists(Query.java:523)    at org.h2.expression.condition.ExistsPredicate.getValue(ExistsPredicate.java:25)    at org.h2.expression.condition.ConditionAndOrN.getValue(ConditionAndOrN.java:128)    at org.h2.expression.condition.ConditionAndOr.getValue(ConditionAndOr.java:106)    at org.h2.expression.condition.ConditionAndOr.getValue(ConditionAndOr.java:110)    at org.h2.expression.Expression.getBooleanValue(Expression.java:332)    at org.h2.table.TableFilter.isOk(TableFilter.java:505)    at org.h2.table.TableFilter.next(TableFilter.java:451)    at org.h2.command.query.Select$LazyResultQueryFlat.fetchNextRow(Select.java:1825)    at org.h2.result.LazyResult.hasNext(LazyResult.java:78)    at org.h2.result.FetchedResult.next(FetchedResult.java:34)    at org.h2.command.query.Select.queryFlat(Select.java:728)    at org.h2.command.query.Select.queryWithoutCache(Select.java:833)    at org.h2.command.query.Query.queryWithoutCacheLazyCheck(Query.java:197)    at org.h2.command.query.Query.query(Query.java:494)    at org.h2.command.query.Query.query(Query.java:457)    at org.h2.index.ViewIndex.find(ViewIndex.java:270)    at org.h2.index.ViewIndex.find(ViewIndex.java:153)    at org.h2.index.IndexCursor.find(IndexCursor.java:161)    at org.h2.table.TableFilter.next(TableFilter.java:394)    at org.h2.command.query.Select.gatherGroup(Select.java:517)    at org.h2.command.query.Select.queryGroup(Select.java:488)    at org.h2.command.query.Select.queryWithoutCache(Select.java:828)    at org.h2.command.query.Query.queryWithoutCacheLazyCheck(Query.java:197)    at org.h2.command.query.Query.query(Query.java:494)    at org.h2.command.query.Query.query(Query.java:457)    at org.h2.command.CommandContainer.query(CommandContainer.java:256)    at org.h2.command.Command.executeQuery(Command.java:190)

Jake Dunn

unread,
Apr 7, 2022, 7:01:21 PM4/7/22
to H2 Database
I've been trying to resolve this issue when running an integration test against an in-memory H2 database. The query itself seems to work fine when running against an actual Postgres instance in normal development, but I get this error when running against H2. Any thoughts on how to resolve?

### Error querying database. Cause: org.h2.jdbc.JdbcSQLNonTransientException: General error: "java.lang.NullPointerException"; SQL statement

[50000-210]    at app//org.h2.message.DbException.getJdbcSQLException(DbException.java:573)    at app//org.h2.message.DbException.getJdbcSQLException(DbException.java:496)    at app//org.h2.message.DbException.get(DbException.java:216)    at app//org.h2.message.DbException.convert(DbException.java:414)    at app//org.h2.command.Command.executeQuery(Command.java:211)    at app//org.h2.jdbc.JdbcPreparedStatement.execute(JdbcPreparedStatement.java:248)    at app//com.zaxxer.hikari.pool.ProxyPreparedStatement.execute(ProxyPreparedStatement.java:44)    at app//com.zaxxer.hikari.pool.HikariProxyPreparedStatement.execute(HikariProxyPreparedStatement.java)    at java...@11.0.12/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)    at java...@11.0.12/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)    at java...@11.0.12/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)    at java...@11.0.12/java.lang.reflect.Method.invoke(Method.java:566)    at app//org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:59)    at platform//com.sun.proxy.$Proxy308.execute(Unknown Source)    at app//org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:64)    at app//org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79)    at app//org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:63)    at app//org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:325)    at app//org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)    at app//org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)    at app//org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:89)    at app//org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:151)    at app//org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:145)    at app//org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140)    at app//org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:76)    at java...@11.0.12/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)    at java...@11.0.12/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)    at java...@11.0.12/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)    at java...@11.0.12/java.lang.reflect.Method.invoke(Method.java:566)    at app//org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:427)    ... 150 more Caused by: java.lang.NullPointerException    at org.h2.command.query.Query.getParameterValues(Query.java:449)    at org.h2.command.query.Query.exists(Query.java:523)    at org.h2.expression.condition.ExistsPredicate.getValue(ExistsPredicate.java:25)    at org.h2.expression.condition.ConditionAndOrN.getValue(ConditionAndOrN.java:128)    at org.h2.expression.condition.ConditionAndOr.getValue(ConditionAndOr.java:106)    at org.h2.expression.condition.ConditionAndOr.getValue(ConditionAndOr.java:110)    at org.h2.expression.Expression.getBooleanValue(Expression.java:332)    at org.h2.table.TableFilter.isOk(TableFilter.java:505)    at org.h2.table.TableFilter.next(TableFilter.java:451)    at org.h2.command.query.Select$LazyResultQueryFlat.fetchNextRow(Select.java:1825)    at org.h2.result.LazyResult.hasNext(LazyResult.java:78)    at org.h2.result.FetchedResult.next(FetchedResult.java:34)    at org.h2.command.query.Select.queryFlat(Select.java:728)    at org.h2.command.query.Select.queryWithoutCache(Select.java:833)    at org.h2.command.query.Query.queryWithoutCacheLazyCheck(Query.java:197)    at org.h2.command.query.Query.query(Query.java:494)    at org.h2.command.query.Query.query(Query.java:457)    at org.h2.index.ViewIndex.find(ViewIndex.java:270)    at org.h2.index.ViewIndex.find(ViewIndex.java:153)    at org.h2.index.IndexCursor.find(IndexCursor.java:161)    at org.h2.table.TableFilter.next(TableFilter.java:394)    at org.h2.command.query.Select.gatherGroup(Select.java:517)    at org.h2.command.query.Select.queryGroup(Select.java:488)    at org.h2.command.query.Select.queryWithoutCache(Select.java:828)    at org.h2.command.query.Query.queryWithoutCacheLazyCheck(Query.java:197)    at org.h2.command.query.Query.query(Query.java:494)    at org.h2.command.query.Query.query(Query.java:457)    at org.h2.command.CommandContainer.query(CommandContainer.java:256)    at org.h2.command.Command.executeQuery(Command.java:190)    ... 175 more


Noel Grandin

unread,
Apr 8, 2022, 4:04:02 PM4/8/22
to H2 Database
If you can provide a standalone test case, we can probably debug the issue

Andrei Tokar

unread,
Apr 9, 2022, 7:55:42 PM4/9/22
to H2 Database
I wonder, if you hit this bug
It was fixed in a newly released 2.1.212

Jake Dunn

unread,
Apr 19, 2022, 10:18:45 AM4/19/22
to H2 Database
Thank you both for the responses. Upgrading to 2.1.212 did resolve the issue.
Reply all
Reply to author
Forward
0 new messages