Exception in Finalizer

533 views
Skip to first unread message

kefa

unread,
Oct 3, 2008, 7:07:39 PM10/3/08
to H2 Database
Hello everyone,

I'm getting strange exceptions in Finalizer thread.
First this exception happens:
Daemon System Thread [Finalizer] (Suspended (exception
NullPointerException))
JdbcOdbcDriver.finalize() line: 96 [local variables unavailable]
Thread.run() line: 619
When I click in the stack on line "JdbcOdbcDriver.finalize() line: 96
[local variables unavailable]", Eclipse shows following variables:
this JdbcOdbcDriver (id=55)
iTimeOut 0
outWriter null
tracer JdbcOdbcTracer (id=61)
outWriter null

When I resume, immediately after first exception, second exception
happens:
Daemon System Thread [Finalizer] (Suspended (exception Error))
Session.finalize() line: 212 [local variables unavailable]
Thread.run() line: 619

Line number 212 in Session.java is this line:
throw Message.getInternalError("not closed", stackTrace);

But I can't see the stack trace and no exception appears in my
DefaultUncaughtExceptionsHandler, so I can't provide more information.
Does anyone have an idea if this is OK? I would love to provide more
information, but I don't know how.

I'm using the latest version of H2(1.0.79) and this happens *ONLY*
with JRockIt jrrt-3.0.0-1.6.0-windows-ia32.

Stefan

Thomas Mueller

unread,
Oct 4, 2008, 2:59:51 AM10/4/08
to h2-da...@googlegroups.com
Hi,

The first exception is related to the JDBC-ODBC bridge that comes with
the JDK. This is unrelated to H2. H2 doesn't use it. Do you use
database URLs of the form jdbc:odbc:? Probably not. However the driver
is loaded by default. Maybe it helps if you read the source code of
this driver.

The second exception looks like an unclosed database connection to a
H2 database. Could you check if the the stack trace in the file
.trace.db?

Regards,
Thomas

kefa

unread,
Oct 4, 2008, 5:12:28 PM10/4/08
to H2 Database
Hi Thomas,
I have only this in the stack trace file:

10-04 23:04:20 jdbc[3]: SQLException
org.h2.jdbc.JdbcSQLException: Database is already closed (to disable
automatic closing at VM shutdown, add ";DB_CLOSE_ON_EXIT=FALSE" to the
db URL) [90121-79]
at org.h2.message.Message.getSQLException(Message.java:103)
at org.h2.message.Message.getSQLException(Message.java:114)
at org.h2.message.Message.getSQLException(Message.java:77)
at org.h2.message.Message.getSQLException(Message.java:149)
at org.h2.jdbc.JdbcConnection.checkClosed(JdbcConnection.java:1283)
at org.h2.jdbc.JdbcConnection.getAutoCommit(JdbcConnection.java:402)
at
com.ibatis.common.jdbc.SimpleDataSource.forceCloseAll(SimpleDataSource.java:
504)
at
com.ibatis.common.jdbc.SimpleDataSource.finalize(SimpleDataSource.java:
738)
at java.lang.Thread.run(Thread.java:619)
10-04 23:04:20 jdbc[3]: Connection not closed
java.lang.Exception: Stack Trace
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:142)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:88)
at org.h2.Driver.connect(Driver.java:57)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at
com.ibatis.common.jdbc.SimpleDataSource.popConnection(SimpleDataSource.java:
580)
at
com.ibatis.common.jdbc.SimpleDataSource.getConnection(SimpleDataSource.java:
222)
at
com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction.init(JdbcTransaction.java:
48)
at
com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction.getConnection(JdbcTransaction.java:
89)
at
com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryForObject(MappedStatement.java:
120)
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:
518)
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:
493)
at
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:
106)
at
com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForObject(SqlMapClientImpl.java:
82)
at sk.trader.core.Backtester.test(Backtester.java:215)
at sk.trader.core.Backtester.runTest(Backtester.java:169)
at sk.trader.core.Backtester.start(Backtester.java:84)
at org.netbeans.api.wizard.displayer.WizardDisplayerImpl
$4.run(WizardDisplayerImpl.java:495)
at java.lang.Thread.run(Thread.java:619)


The two exceptions described in my 1st post are not there.


On Oct 4, 8:59 am, "Thomas Mueller" <thomas.tom.muel...@gmail.com>
wrote:
> Hi,
>
> The first exception is related to the JDBC-ODBC bridge that comes with
> the JDK. This is unrelated to H2. H2 doesn't use it. Do you use
> database URLs of the form jdbc:odbc:? Probably not. However the driver
> is loaded by default. Maybe it helps if you read the source code of
> this driver.
>
> The second exception looks like an unclosed database connection to a
> H2 database. Could you check if the the stack trace in the file
> .trace.db?
>
> Regards,
> Thomas
>

Thomas Mueller

unread,
Oct 5, 2008, 9:04:10 AM10/5/08
to h2-da...@googlegroups.com
Hi,

Thanks!

The first exception is because iBatis 2 tries to close all
connections, but the given connection is already closed. See also:
http://svn.apache.org/repos/asf/ibatis/trunk/java/ibatis-2/ibatis-2-core/src/com/ibatis/common/jdbc/SimpleDataSource.java
- it is not problematic. Too bad iBatis doesn't use
Connection.isClosed() before calling getAutoCommit().

The second stack trace is caused by an unclosed connection. The stack
trace says the connection was opened in the given place:

at com.ibatis.common.jdbc.SimpleDataSource.popConnection(SimpleDataSource.java:580)
at com.ibatis.common.jdbc.SimpleDataSource.getConnection(SimpleDataSource.java:222)
at com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction.init(JdbcTransaction.java:48)
at com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction.getConnection(JdbcTransaction.java:89)
at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryForObject(MappedStatement.java:120)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:518)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:493)
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:106)
at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForObject(SqlMapClientImpl.java:82)
at sk.trader.core.Backtester.test(Backtester.java:215)
at sk.trader.core.Backtester.runTest(Backtester.java:169)
at sk.trader.core.Backtester.start(Backtester.java:84)
at org.netbeans.api.wizard.displayer.WizardDisplayerImpl

I suggest you check your code to make sure all iBatis object,
connections and connection pools are closed.

Regards,
Thomas

Reply all
Reply to author
Forward
0 new messages