I am trying to set up an HSQL database for testing using versions 2.2.9, Hibernate 3.6.9 and Spring 3.1.2. We used the local postgresql database, but we make the choice for testing. I have 40-50 test classes in which more than 200 tests. Each test class works fine if it runs separately from the eclipse. When I use Maven to compile and test everything, I have test errors. At some point, it looks like you are trying to run my init.sql script again and create the tables again. I get this as my last reason:
Caused by: org.hsqldb.HsqlException: object name already exists: DUAL_ASSET_ASSETID_SEQ at org.hsqldb.error.Error.error(Unknown Source) at org.hsqldb.error.Error.error(Unknown Source) at org.hsqldb.SchemaObjectSet.checkAdd(Unknown Source) at org.hsqldb.SchemaManager.checkSchemaObjectNotExists(Unknown Source) at org.hsqldb.StatementSchema.setOrCheckObjectName(Unknown Source) at org.hsqldb.StatementSchema.getResult(Unknown Source) at org.hsqldb.StatementSchema.execute(Unknown Source) at org.hsqldb.Session.executeCompiledStatement(Unknown Source) at org.hsqldb.Session.executeDirectStatement(Unknown Source) at org.hsqldb.Session.execute(Unknown Source) ... 52 more
I tried to use 'IF NOT EXISTS' when creating this table, but when I go to create a sequence, I get the same error. Therefore, it tries to do more than just one table, and I cannot use βIF DOES NOT EXISTβ in the CREATE SEQUENCE statement, so I am stuck there.
Is there a reason my data is loading again? Sometimes I get this error:
2012-10-16 10:55:48,489 [Thread-0] WARN org.springframework.jdbc.datasource.embedded.HsqlEmbeddedDatabaseConfigurer:shutdown:46 - Could not shutdown embedded database java.sql.SQLException: Database lock acquisition failure: attempt to connect while db opening /closing at org.hsqldb.jdbc.Util.sqlException(Unknown Source) at org.hsqldb.jdbc.Util.sqlException(Unknown Source) at org.hsqldb.jdbc.JDBCConnection.<init>(Unknown Source) at org.hsqldb.jdbc.JDBCDriver.getConnection(Unknown Source) at org.hsqldb.jdbc.JDBCDriver.connect(Unknown Source) at org.springframework.jdbc.datasource.SimpleDriverDataSource.getConnectionFromDriver(SimpleDriverDataSource.java:140) at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnectionFromDriver(AbstractDriverBasedDataSource.java:149) at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnection(AbstractDriverBasedDataSource.java:119) at org.springframework.jdbc.datasource.embedded.AbstractEmbeddedDatabaseConfigurer.shutdown(AbstractEmbeddedDatabaseConfigurer.java:40) at org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseFactory.shutdownDatabase(EmbeddedDatabaseFactory.java:152) at org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseFactoryBean.destroy(EmbeddedDatabaseFactoryBean.java:65) at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:211) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:498) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:474) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:442) at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1071) at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1045) at org.springframework.context.support.AbstractApplicationContext$1.run(AbstractApplicationContext.java:963) Caused by: org.hsqldb.HsqlException: Database lock acquisition failure: attempt to connect while db opening /closing at org.hsqldb.error.Error.error(Unknown Source) at org.hsqldb.error.Error.error(Unknown Source) at org.hsqldb.error.Error.error(Unknown Source) at org.hsqldb.DatabaseManager.getDatabase(Unknown Source) at org.hsqldb.DatabaseManager.newSession(Unknown Source) ... 16 more
Mike desmarais
source share