问题
I am using H2 database in client-server mode. Server is running with version 1.3.175 and client with 1.3.168.
Everything seems working fine, but I get an exception executing some queries:
org.h2.jdbc.JdbcSQLException: General error: "java.lang.NullPointerException" [50000-175] at org.h2.message.DbException.getJdbcSQLException(DbException.java:332) at org.h2.message.DbException.get(DbException.java:161) at org.h2.message.DbException.convert(DbException.java:284) at org.h2.server.TcpServerThread.sendError(TcpServerThread.java:218) at org.h2.server.TcpServerThread.run(TcpServerThread.java:158) at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException at org.h2.expression.Function.getCost(Function.java:2391) at org.h2.expression.CompareLike.getCost(CompareLike.java:417) at org.h2.expression.ConditionAndOr.optimize(ConditionAndOr.java:133) at org.h2.command.dml.Select.prepare(Select.java:813) at org.h2.command.Parser.prepareCommand(Parser.java:240) at org.h2.engine.Session.prepareLocal(Session.java:436) at org.h2.server.TcpServerThread.process(TcpServerThread.java:260) at org.h2.server.TcpServerThread.run(TcpServerThread.java:156) ... 1 more
at org.h2.engine.SessionRemote.done(SessionRemote.java:567)
at org.h2.command.CommandRemote.prepare(CommandRemote.java:67)
at org.h2.command.CommandRemote.<init>(CommandRemote.java:46)
at org.h2.engine.SessionRemote.prepareCommand(SessionRemote.java:439)
at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1109)
at org.h2.jdbc.JdbcPreparedStatement.<init>(JdbcPreparedStatement.java:74)
at org.h2.jdbc.JdbcConnection.prepareStatement(JdbcConnection.java:264)
Thanks for help.
回答1:
This is a bug in this version of the database engine, which was fixed in revision 5437 of the trunk.
You can either:
- go back to the previous version (1.3.174) which should not have this bug,
- use the latest nightly build where it should be fixed,
- download the latest source code and built the database yourself, or
- wait for the next version of H2.
来源:https://stackoverflow.com/questions/21724841/generic-error-50000-175-caused-by-nullpointerexception