Hi, Where did you find the stack trace you posted? Was it in system.err or system.out? As Noel wrote, the error message "Connection not closed" should be there as well, it's strange if it isn't - it might be a bug.
> if I attempt to close any connections from the junit tests Would it be possible to create a new connection in the setUp() method, and close it in the tearDown() method? Could you try to create a simple test case to reproduce the problem? Please try to make the test case as simple as possible, and remove any unneeded code. Probably, you will not even need to execute any statements in the database. Regards, Thomas On Wed, Apr 25, 2012 at 11:30 PM, Michael <[email protected]> wrote: > that's just it - I didn't chop any of the trace and logging > out....it's why I have been so confused about this problem. > > The problem is part of a full junit/dbunit test harness and if I > attempt to close any connections from the junit tests, it breaks all > downstream junits with connection cannot be found exceptions. > > As I study this further, I'm wondering if it's more a dbunit (v2.4.8) > problem, but was hoping that others who had used H2 in this type of > test harness had come across it. Should I solve the issue, I'll post > results. > > thanks all > > On Apr 19, 4:17 am, Noel Grandin <[email protected]> wrote: >> That's because you chopped off the most important bit - the part of the >> stack trace that says "Connection not closed" >> >> This chunk of H2 implements a monitor to make sure that connections are >> closed properly, and it throws an exception when a connection is not closed. >> >> The "Open Stack Trace" section is a stacktrace from the part of your >> code that opened the connection that should have been closed. >> >> On 2012-04-18 20:15, Michael wrote: >> >> >> >> >> >> >> >> > My project at work uses H2 v1.2.135 with dbUnit 2.4.1 in a test-util >> > in-memory database junit test suite that had worked just fine. I am >> > using a Spring (v2.5.6) configuration file to make all the calls as >> > the database code is autowired in via a class called "DatabaseHelper" >> >> > I was finally able to upgrade H2 to v1.3.166 (have to go through a >> > bunch of hoops get approvals for upgrades) and ran my maven install >> > with the upgrade and get this error trace for most, but not all, the >> > junit tests that call the H2 in-memory test suite. No other changes >> > to the environment have been made >> >> > [stack trace begins] >> > 04-18 10:01:00 jdbc[260]: java.lang.Exception: Open Stack Trace >> > at org.h2.util.CloseWatcher.register(CloseWatcher.java:93) >> > at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:122) >> > at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:94) >> > at org.h2.Driver.connect(Driver.java:72) >> > at java.sql.DriverManager.getConnection(DriverManager.java:525) >> > at java.sql.DriverManager.getConnection(DriverManager.java:171) >> > at >> > org.dbunit.JdbcDatabaseTester.getConnection(JdbcDatabaseTester.java: >> > 116) >> > .... >> > [stack trace ends] >> >> > here's a small code snippet from DatabaseHelper (I can't show more >> > than this): >> >> > [code snippet begins] >> >> > // Note: cleanUpDataset simply flushes out any previous DatabaseHelper >> > call's data >> > public void cleanInsert() throws Exception { >> > init(); >> > setReferentialIntegrity(false); >> > DatabaseOperation.DELETE_ALL.execute(connection, cleanUpDataset); >> > DatabaseOperation.INSERT.execute(connection, dataset); >> > setReferentialIntegrity(true); >> > } >> >> > private void init() { >> > try >> > { >> > IDatabaseTester tester = new JdbcDatabaseTester(driver, url, >> > username, password); >> > connection = tester.getConnection(); >> > } >> > catch (ClassNotFoundException e) >> > { >> > log.error("init() ClassNotFoundException: ", e); >> > e.printStackTrace(); >> > return; >> > } >> > catch (Exception e) >> > { >> > log.error("init() Exception: ", e); >> > e.printStackTrace(); >> > return; >> > } >> > ... >> >> > [code snippet ends] >> > Note: none of the log.error() messages show up in my console. >> >> > Placing the trace into the Error Analyzer doesn't give any helpful >> > messages (lists all the errors), here's what I get (notice, I'm >> > actually on v1.3.166) >> >> > [Error Analyzer begin] >> > Error Code: >> > Product Version: 1.3.260 >> > Message: >> > 04-18 10:01:00 jdbc >> > More Information: >> > [Error Analyzer ends] >> >> > Neither Google nor StackOverflow have any information relating to the >> > CloseWatcher class and whatever "Open Stack Trace" is supposed to >> > mean. No search results when searching on dbunit and h2 together >> > either. >> >> > I realize this is a shot in the dark, but has anyone else come across >> > this error trace when using dbunit and has a solution or at least push >> > in the right direction? >> >> > TIA > > -- > You received this message because you are subscribed to the Google Groups "H2 > Database" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/h2-database?hl=en. > -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
