NPE In delete query

73 views
Skip to first unread message

ser...@liveperson.com

unread,
Aug 6, 2017, 1:15:51 PM8/6/17
to H2 Database
Hello,

I'm getting a NPE when I try to delete a specific entry (simple delete query with where key=value). That's the error and stack trace:

General error: "java.lang.NullPointerException"; SQL statement:
delete from exconv_participants_tbl where exconvid='d26aa174-ba39-47c3-b587-7e80d33d1f1d' [50000-196] HY000/50000 (Help)
org.h2.jdbc.JdbcSQLException: General error: "java.lang.NullPointerException"; SQL statement:
delete from exconv_participants_tbl where exconvid='d26aa174-ba39-47c3-b587-7e80d33d1f1d' [50000-192]
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
    at org.h2.message.DbException.get(DbException.java:168)
    at org.h2.message.DbException.convert(DbException.java:295)
    at org.h2.command.Command.executeUpdate(Command.java:266)
    at org.h2.server.TcpServerThread.process(TcpServerThread.java:344)
    at org.h2.server.TcpServerThread.run(TcpServerThread.java:158)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException

    at org.h2.engine.SessionRemote.done(SessionRemote.java:629) 
    at org.h2.command.CommandRemote.executeUpdate(CommandRemote.java:209) 
    at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:192) 
    at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:164) 
    at org.h2.server.web.WebApp.getResult(WebApp.java:1380) 
    at org.h2.server.web.WebApp.query(WebApp.java:1053) 
    at org.h2.server.web.WebApp$1.next(WebApp.java:1015) 
    at org.h2.server.web.WebApp$1.next(WebApp.java:1002) 
    at org.h2.server.web.WebThread.process(WebThread.java:164) 
    at org.h2.server.web.WebThread.run(WebThread.java:89) 
    at java.lang.Thread.run(Unknown Source) 

The database contains around 15k of entries in the table and it happens only with this one. 
I've read that it could be that the data is stored in a corrupted way but i can select it just fine.
I've also tried to run the h2 client with multi_threaded=false, and still no luck.

Any ideas how to fix this? I've tried using the 1.4.192 and 1.4.196 versions of the h2 client.

Thanks,
Sergey

This message may contain confidential and/or privileged information. 
If you are not the addressee or authorized to receive this on behalf of the addressee you must not use, copy, disclose or take action based on this message or any information herein. 
If you have received this message in error, please advise the sender immediately by reply email and delete this message. Thank you.

Noel Grandin

unread,
Aug 6, 2017, 2:11:48 PM8/6/17
to h2-da...@googlegroups.com
you're using two different versions of H2 there, try using the same version on both sides

ser...@liveperson.com

unread,
Aug 7, 2017, 3:51:44 AM8/7/17
to H2 Database
I'm normally using 192 on both, I just tried the newest client just to check if there were a fix.

Noel Grandin

unread,
Aug 7, 2017, 4:06:15 PM8/7/17
to h2-da...@googlegroups.com
what does the full stack trace look like, that one seems to be missing some bits​

ser...@liveperson.com

unread,
Aug 8, 2017, 9:16:38 AM8/8/17
to H2 Database
That's the entire stack trace:
delete from exconv_participants_tbl where exconvid='d26aa174-ba39-47c3-b587-7e80d33d1f1d';
General error: "java.lang.NullPointerException"; SQL statement:
delete from exconv_participants_tbl where exconvid='d26aa174-ba39-47c3-b587-7e80d33d1f1d' [50000-192] HY000/50000 (Help)
org.h2.jdbc.JdbcSQLException: General error: "java.lang.NullPointerException"; SQL statement:
delete from exconv_participants_tbl where exconvid='d26aa174-ba39-47c3-b587-7e80d33d1f1d' [50000-192]
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
    at org.h2.message.DbException.get(DbException.java:168)
    at org.h2.message.DbException.convert(DbException.java:295)
    at org.h2.command.Command.executeUpdate(Command.java:266)
    at org.h2.server.TcpServerThread.process(TcpServerThread.java:344)
    at org.h2.server.TcpServerThread.run(TcpServerThread.java:158)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException

    at org.h2.engine.SessionRemote.done(SessionRemote.java:624) 
    at org.h2.command.CommandRemote.executeUpdate(CommandRemote.java:191) 
    at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:184) 
    at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:158) 
    at org.h2.server.web.WebApp.getResult(WebApp.java:1388) 
    at org.h2.server.web.WebApp.query(WebApp.java:1061) 
    at org.h2.server.web.WebApp$1.next(WebApp.java:1023) 
    at org.h2.server.web.WebApp$1.next(WebApp.java:1010) 
    at org.h2.server.web.WebThread.process(WebThread.java:164) 
    at org.h2.server.web.WebThread.run(WebThread.java:89) 
    at java.lang.Thread.run(Unknown Source) 

Noel Grandin

unread,
Aug 8, 2017, 3:08:02 PM8/8/17
to h2-da...@googlegroups.com
Sorry, I have no idea what is going on there. The stack trace is incomplete for some weird reason, so I don't even know where the NullPointerException is actually coming from.​

ser...@liveperson.com

unread,
Aug 9, 2017, 7:27:02 AM8/9/17
to H2 Database
That's the full stack trace in our system:

org.h2.jdbc.JdbcSQLException: General error: "java.lang.NullPointerException"; SQL statement:
/* ExtendedConversationH2Dao._deletePartitipants */ DELETE FROM EXCONV_PARTICIPANTS_TBL WHERE EXCONVID=? [50000-192]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
at org.h2.message.DbException.get(DbException.java:168)
at org.h2.message.DbException.convert(DbException.java:295)
at org.h2.command.Command.executeUpdate(Command.java:266)
at org.h2.jdbc.JdbcPreparedStatement.execute(JdbcPreparedStatement.java:201)
at org.skife.jdbi.v2.SQLStatement.internalExecute(SQLStatement.java:1327)
... 36 common frames omitted
Caused by: java.lang.NullPointerException: null
at org.skife.jdbi.v2.SQLStatement.internalExecute(SQLStatement.java:1338)
at org.skife.jdbi.v2.Update.execute(Update.java:56)
at org.skife.jdbi.v2.sqlobject.UpdateHandler$2.value(UpdateHandler.java:68)
at org.skife.jdbi.v2.sqlobject.UpdateHandler.invoke(UpdateHandler.java:81)
at org.skife.jdbi.v2.sqlobject.SqlObject.invoke(SqlObject.java:212)
at org.skife.jdbi.v2.sqlobject.SqlObject$2.intercept(SqlObject.java:109)
at com.liveperson.cqm.dal.h2impl.dao.ExtendedConversationH2Dao$$EnhancerByCGLIB$$f403050f._deletePartitipants(<generated>)
at com.liveperson.cqm.dal.h2impl.dao.ExtendedConversationH2Dao.delete(ExtendedConversationH2Dao.java:637)
at com.liveperson.cqm.dal.h2impl.dao.ExtendedConversationH2Dao$$EnhancerByCGLIB$$f403050f.CGLIB$delete$1(<generated>)
at com.liveperson.cqm.dal.h2impl.dao.ExtendedConversationH2Dao$$EnhancerByCGLIB$$f403050f$$FastClassByCGLIB$$208a19b8.invoke(<generated>)
at org.skife.jdbi.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.skife.jdbi.v2.sqlobject.PassThroughTransactionHandler$1.inTransaction(PassThroughTransactionHandler.java:52)
at org.skife.jdbi.v2.tweak.transactions.LocalTransactionHandler.inTransaction(LocalTransactionHandler.java:183)
at org.skife.jdbi.v2.BasicHandle.inTransaction(BasicHandle.java:330)
at org.skife.jdbi.v2.sqlobject.PassThroughTransactionHandler.invoke(PassThroughTransactionHandler.java:46)
at org.skife.jdbi.v2.sqlobject.SqlObject.invoke(SqlObject.java:212)
at org.skife.jdbi.v2.sqlobject.SqlObject$2.intercept(SqlObject.java:109)
at com.liveperson.cqm.dal.h2impl.dao.ExtendedConversationH2Dao$$EnhancerByCGLIB$$f403050f.delete(<generated>)
at com.liveperson.cqm.dal.h2impl.dao.ExtendedConversationH2Dao.lambda$delete$1(ExtendedConversationH2Dao.java:620)
at java.util.ArrayList.forEach(ArrayList.java:1249)
at com.liveperson.cqm.dal.h2impl.dao.ExtendedConversationH2Dao.delete(ExtendedConversationH2Dao.java:618)
at com.liveperson.cqm.dal.h2impl.dao.ExtendedConversationH2Dao$$EnhancerByCGLIB$$f403050f.CGLIB$delete$0(<generated>)
at com.liveperson.cqm.dal.h2impl.dao.ExtendedConversationH2Dao$$EnhancerByCGLIB$$f403050f$$FastClassByCGLIB$$208a19b8.invoke(<generated>)
at org.skife.jdbi.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.skife.jdbi.v2.sqlobject.PassThroughHandler.invoke(PassThroughHandler.java:34)
at org.skife.jdbi.v2.sqlobject.SqlObject.invoke(SqlObject.java:212)
at org.skife.jdbi.v2.sqlobject.SqlObject$2.intercept(SqlObject.java:109)
at com.liveperson.cqm.dal.h2impl.dao.ExtendedConversationH2Dao$$EnhancerByCGLIB$$f403050f.delete(<generated>)
at com.liveperson.cqm.dal.h2impl.cleaner.CleanerTask.cleanUnUpdatedConversations(CleanerTask.java:101)
at com.liveperson.cqm.dal.h2impl.cleaner.CleanerTask.run(CleanerTask.java:58)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

That's the exception message:
org.h2.jdbc.JdbcSQLException: General error: "java.lang.NullPointerException"; SQL statement: /* ExtendedConversationH2Dao._deletePartitipants */ DELETE FROM EXCONV_PARTICIPANTS_TBL WHERE EXCONVID=? [50000-192] [statement:"DELETE FROM EXCONV_PARTICIPANTS_TBL WHERE EXCONVID=:EXCONVID", located:"DELETE FROM EXCONV_PARTICIPANTS_TBL WHERE EXCONVID=:EXCONVID", rewritten:"/* ExtendedConversationH2Dao._deletePartitipants */ DELETE FROM EXCONV_PARTICIPANTS_TBL WHERE EXCONVID=?", arguments:{ positional:{}, named:{EXCONVID:'d26aa174-ba39-47c3-b587-7e80d33d1f1d'}, finder:[]}]

Noel Grandin

unread,
Aug 9, 2017, 7:34:57 AM8/9/17
to h2-da...@googlegroups.com
So if I am reading that right, the actual exception source is inside the JDBI library that you are using?

ser...@liveperson.com

unread,
Aug 9, 2017, 8:40:42 AM8/9/17
to H2 Database
Yeah, but then I tried executing the query directly using an h2 client(downloaded from the official h2 site) and got the same NPE with the stack trace i initially posted.

Noel Grandin

unread,
Aug 9, 2017, 8:45:53 AM8/9/17
to h2-da...@googlegroups.com
maybe try turning on the trace options and see what shows up in the server-side trace log

Reply all
Reply to author
Forward
0 new messages