项目场景:
启动应用花了好长时间,最后报出异常.
问题描述
启动应用花了好长时间,最后报出异常.
异常:
Caused by: liquibase.exception.LockException: Could not acquire change log lock. Currently locked by LAPTOP-OQ9VB2CI (192.168.126.1) since 2024/8/9 下午9:30
at liquibase.lockservice.StandardLockService.waitForLock(StandardLockService.java:234) ~[liquibase-core-4.5.0.jar:na]
at liquibase.Liquibase.lambda$update$1(Liquibase.java:214) ~[liquibase-core-4.5.0.jar:na]
at liquibase.Scope.lambda$child$0(Scope.java:177) ~[liquibase-core-4.5.0.jar:na]
at liquibase.Scope.child(Scope.java:186) ~[liquibase-core-4.5.0.jar:na]
at liquibase.Scope.child(Scope.java:176) ~[liquibase-core-4.5.0.jar:na]
at liquibase.Scope.child(Scope.java:155) ~[liquibase-core-4.5.0.jar:na]
at liquibase.Liquibase.runInScope(Liquibase.java:2404) ~[liquibase-core-4.5.0.jar:na]
at liquibase.Liquibase.update(Liquibase.java:211) ~[liquibase-core-4.5.0.jar:na]
at liquibase.Liquibase.update(Liquibase.java:197) ~[liquibase-core-4.5.0.jar:na]
at liquibase.integration.spring.SpringLiquibase.performUpdate(SpringLiquibase.java:314) ~[liquibase-core-4.5.0.jar:na]
at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:269) ~[liquibase-core-4.5.0.jar:na]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863) ~[spring-beans-5.3.31.jar:5.3.31]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800) ~[spring-beans-5.3.31.jar:5.3.31]
... 75 common frames omitted
原因分析:
“liquibase.exception.LockException: Could not acquire change log lock. ”
select * from DATABASECHANGELOGLOCK;
可以判断是出现了分布式锁异常
解决方案:
update DATABASECHANGELOGLOCK set LOCKED="", LOCKGRANTED=null, LOCKEDBY=null where ID=1;