How can this happen.
Isn't liquibase supposed to create this table for itself...
This is an in memory database created for unit testing.
public void setUp(String contexts) { try { ResourceAccessor resourceAccessor = new FileSystemResourceAccessor(); Class.forName("org.hsqldb.jdbcDriver"); holdingConnection = getConnectionImpl(); HsqlConnection hsconn = new HsqlConnection(holdingConnection); liquibase = new Liquibase(CHANGE_LOG, resourceAccessor, hsconn); liquibase.dropAll(); liquibase.update(contexts); hsconn.close(); } catch (Exception ex) { LOG.error("Error during database initialization", ex); throw new RuntimeException("Error during database initialization", ex); } } private Connection getConnectionImpl() throws SQLException { return DriverManager.getConnection(CONNECTION_STRING, USER_NAME, PASSWORD); }
Same as in the hsqldb examples
The stacktrace:
2014-06-15 21:50:34,195 [DEBUG] [PropertySourcesPropertyResolver,getProperty(),103] - Could not find key 'spring.liveBeansView.mbeanDomain' in any property source. Returning [null] 2014-06-15 21:50:34,195 [DEBUG] [CacheAwareContextLoaderDelegate,loadContext(),93] - Storing ApplicationContext in cache under key [[MergedContextConfiguration@5879ff89 testClass = SampleUnitTest, locations = '{}', classes = '{class context.RepositoryContextConfig, class context.repoConfig}', contextInitializerClasses = '[]', activeProfiles = '{}', contextLoader = 'org.springframework.test.context.support.DelegatingSmartContextLoader', parent = [null]]]. 2014-06-15 21:50:34,198 [DEBUG] [AbstractBeanFactory,doGetBean(),249] - Returning cached instance of singleton bean 'org.springframework.transaction.config.internalTransactionAdvisor' INFO 21:50 15/06/14: liquibase: Successfully acquired change log lock INFO 21:50 15/06/14: liquibase: Dropping Database Objects in schema: PUBLIC.PUBLIC INFO 21:50 15/06/14: liquibase: Creating database history table with name: PUBLIC.DATABASECHANGELOG INFO 21:50 15/06/14: liquibase: Successfully released change log lock 2014-06-15 21:51:17,842 [ERROR] [HsqlDatabase,setUp(),41] - Error during database initialization liquibase.exception.LockException: liquibase.exception.UnexpectedLiquibaseException: liquibase.exception.DatabaseException: Error executing SQL select count(*) from PUBLIC.DATABASECHANGELOGLOCK: user lacks privilege or object not found: DATABASECHANGELOGLOCK at liquibase.lockservice.StandardLockService.acquireLock(StandardLockService.java:214) at liquibase.lockservice.StandardLockService.waitForLock(StandardLockService.java:153) at liquibase.Liquibase.update(Liquibase.java:182) at liquibase.Liquibase.update(Liquibase.java:174) at context.HsqlDatabase.setUp(HsqlDatabase.java:38) at context.SampleUnitTest.onlyOnce(SampleUnitTest.java:19) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24) at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74) at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83) at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:233) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:87) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:176) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) Caused by: liquibase.exception.UnexpectedLiquibaseException: liquibase.exception.DatabaseException: Error executing SQL select count(*) from PUBLIC.DATABASECHANGELOGLOCK: user lacks privilege or object not found: DATABASECHANGELOGLOCK at liquibase.lockservice.StandardLockService.isDatabaseChangeLogLockTableInitialized(StandardLockService.java:121) at liquibase.lockservice.StandardLockService.init(StandardLockService.java:95) at liquibase.lockservice.StandardLockService.acquireLock(StandardLockService.java:187)