mattshma/bigdata

nested exception is liquibase.exception.ValidationFailedException: Validation Failed: 1 change sets check sum

mattshma opened this issue · 0 comments

启动 tomcat 后,报错:

2019-01-22 20:44:06.301  WARN 28077 --- [ost-startStop-1] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [config/LiquibaseConfiguration.class]: Invocation of init method failed; nested exception is liquibase.exception.ValidationFailedException: Validation Failed:
     1 change sets check sum
          config/liquibase/changelog/20181015070823_added_entity_Host.xml::20181015070823-1::jhipster was: 7:0f58290e23027b05f03998b58c8c1761 but is now: 7:bb70963c51815d493a26b93323e0845b

2019-01-22 20:44:06.352 ERROR 28077 --- [ost-startStop-1] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [config/LiquibaseConfiguration.class]: Invocation of init method failed; nested exception is liquibase.exception.ValidationFailedException: Validation Failed:
     1 change sets check sum
          config/liquibase/changelog/20181015070823_added_entity_Host.xml::20181015070823-1::jhipster was: 7:0f58290e23027b05f03998b58c8c1761 but is now: 7:bb70963c51815d493a26b93323e0845b

执行 mvn -Pprod liquibase:clearCheckSums 清理checksum,报错:

[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:3.5.5:clearCheckSums (default-cli) on project mirana: Execution default-cli of goal org.liquibase:liquibase-maven-plugin:3.5.5:clearCheckSums failed:
[ERROR] No X11 DISPLAY variable was set, but this program performed an operation which requires it.
[ERROR] -> [Help 1]

SO 上查了下,设置 export DISPLAY=:0.0,结果又报错:

Exception in thread "main" java.awt.AWTError: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable

又 Google 了下,在 Liquibase Maven Plugin - Issue with non local database 找到答案。 pom.xml liquibase 配置中添加 <promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>,如下:

<plugin>
                <groupId>org.liquibase</groupId>
                <artifactId>liquibase-maven-plugin</artifactId>
                <version>${liquibase.version}</version>
                <configuration>
                    <promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>
....

再次执行 mvn -Pprod liquibase:clearCheckSums 即可。