liquibase change sets check sum
mattshma opened this issue · comments
mattshma commented
修改 entities 后,启动报错:
2018-10-15 16:40:34.840 ERROR 11916 --- [rana-Executor-1] i.g.j.c.liquibase.AsyncSpringLiquibase : Liquibase could not start correctly, your database is NOT ready: Validation Failed:
1 change sets check sum
config/liquibase/changelog/00000000000000_initial_schema.xml::00000000000001::jhipster was: 7:4afb46bcf498cc2fd904f4b91e294183 but is now: 7:cc0665bf5aeb32a049f4bc35b0bdceff
liquibase.exception.ValidationFailedException: Validation Failed:
1 change sets check sum
config/liquibase/changelog/00000000000000_initial_schema.xml::00000000000001::jhipster was: 7:4afb46bcf498cc2fd904f4b91e294183 but is now: 7:cc0665bf5aeb32a049f4bc35b0bdceff
at liquibase.changelog.DatabaseChangeLog.validate(DatabaseChangeLog.java:266)
at liquibase.Liquibase.update(Liquibase.java:210)
at liquibase.Liquibase.update(Liquibase.java:192)
at liquibase.integration.spring.SpringLiquibase.performUpdate(SpringLiquibase.java:431)
at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:388)
at io.github.jhipster.config.liquibase.AsyncSpringLiquibase.initDb(AsyncSpringLiquibase.java:103)
at io.github.jhipster.config.liquibase.AsyncSpringLiquibase.lambda$afterPropertiesSet$0(AsyncSpringLiquibase.java:83)
at io.github.jhipster.async.ExceptionHandlingAsyncTaskExecutor.lambda$createWrappedRunnable$1(ExceptionHandlingAsyncTaskExecutor.java:68)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
mattshma commented
执行 mvn liquibase:clearCheckSums
,报错如下:
[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:3.5.5:diff (default-cli) on project mirana: Error setting up or running Liquibase: liquibase.exception.DatabaseException: java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES) -> [Help 1]
看报错是 liqiubase 没权限访问数据库,找到 pom.xml,配置 liqiubase。
<configuration>
<changeLogFile>src/main/resources/config/liquibase/master.xml</changeLogFile>
<diffChangeLogFile>src/main/resources/config/liquibase/changelog/${maven.build.timestamp}_changelog.xml</diffChangeLogFile>
<driver>com.mysql.jdbc.Driver</driver>
<url>jdbc:mysql://localhost:3306/mirana</url>
<defaultSchemaName>mirana</defaultSchemaName>
<username>root</username>
<password></password>
<referenceUrl>hibernate:spring:xxx.domain?dialect=org.hibernate.dialect.MySQL5InnoDBDialect&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy</referenceUrl>
<verbose>true</verbose>
<logging>debug</logging>
</configuration>
添加密码。然后再次执行:mvn liquibase:clearCheckSums
。执行完后,启动服务即可。