在开发中,当我们连上数据库的时候,会报下面的这样一个错误:
- 具体的错误如下
liquibase.exception.LockException: Could not acquire change log lock. Currently locked by 10.45.12.87 (10.45.12.87) since 9/3/19 6:24 PM at liquibase.lockservice.StandardLockService.waitForLock(StandardLockService.java:230) at liquibase.Liquibase.update(Liquibase.java:184) at liquibase.Liquibase.update(Liquibase.java:179) at liquibase.integration.spring.SpringLiquibase.performUpdate(SpringLiquibase.java:353) at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:305) at io.github.jhipster.config.liquibase.AsyncSpringLiquibase.initDb(AsyncSpringLiquibase.java:119) at io.github.jhipster.config.liquibase.AsyncSpringLiquibase.lambda$afterPropertiesSet$0(AsyncSpringLiquibase.java:94) at io.github.jhipster.async.ExceptionHandlingAsyncTaskExecutor.lambda$createWrappedRunnable$1(ExceptionHandlingAsyncTaskExecutor.java:78) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)
- 出现这个问题的原因是我们要操作的数据库需要进行一些设置
例如我这里Java项目连的是selfservice数据库
- 解决这个问题需要执行以下三条命令
注意一定是要连上项目中所使用的数据库,登录上去过后执行。
use selfservice(换成你自己的数据库);
select * from DATABASECHANGELOGLOCK;
update DATABASECHANGELOGLOCK set LOCKED="", LOCKGRANTED=null, LOCKEDBY=null where ID=1;
select * from DATABASECHANGELOGLOCK;
- 执行成功后,再次启动项目
启动成功,问题解决!