【问题标题】:New authority Jhipster新权威Jhipster
【发布时间】:2021-09-22 01:05:51
【问题描述】:

我按照文章https://www.jhipster.tech/tips/025_tip_create_new_authority.html中的说明添加了一个新的权限“ROLE_CLIENT”之后,我重新启动了我的项目,出现了错误:

2021-07-13 00:22:46.592  WARN 3596 --- [  restartedMain] iguration$LoadBalancerCaffeineWarnLogger : Spring Cloud LoadBalancer is currently working with the default cache. You can switch to using Caffeine cache, by adding it and org.springframework.cache.caffeine.CaffeineCacheManager to the classpath.
2021-07-13 00:22:46.806 ERROR 3596 --- [ gateway-task-1] t.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: 8:06225dfc05215e6b13d8a4febd3fd90f but is now: 8:2272077bd3e9baf389312f0e018e5795


liquibase.exception.ValidationFailedException: Validation Failed:
     1 change sets check sum
          config/liquibase/changelog/00000000000000_initial_schema.xml::00000000000001::jhipster was: 8:06225dfc05215e6b13d8a4febd3fd90f but is now: 8:2272077bd3e9baf389312f0e018e5795

        at liquibase.changelog.DatabaseChangeLog.validate(DatabaseChangeLog.java:299)
        at liquibase.Liquibase.lambda$update$1(Liquibase.java:237)
        at liquibase.Scope.lambda$child$0(Scope.java:160)
        at liquibase.Scope.child(Scope.java:169)
        at liquibase.Scope.child(Scope.java:159)
        at liquibase.Scope.child(Scope.java:138)
        at liquibase.Liquibase.runInScope(Liquibase.java:2370)
        at liquibase.Liquibase.update(Liquibase.java:217)
        at liquibase.Liquibase.update(Liquibase.java:203)
        at liquibase.integration.spring.SpringLiquibase.performUpdate(SpringLiquibase.java:321)
        at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:275)
        at org.springframework.boot.autoconfigure.liquibase.DataSourceClosingSpringLiquibase.afterPropertiesSet(DataSourceClosingSpringLiquibase.java:46)
        at tech.jhipster.config.liquibase.AsyncSpringLiquibase.initDb(AsyncSpringLiquibase.java:118)
        at tech.jhipster.config.liquibase.AsyncSpringLiquibase.lambda$afterPropertiesSet$0(AsyncSpringLiquibase.java:93)
        at tech.jhipster.async.ExceptionHandlingAsyncTaskExecutor.lambda$createWrappedRunnable$1(ExceptionHandlingAsyncTaskExecutor.java:78)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:834)

顺便说一下,我正在使用微服务架构和 JWT 身份验证。

【问题讨论】:

    标签: jhipster liquibase jhipster-gateway


    【解决方案1】:

    这很正常:Liquibase 变更集应该是不可变的。

    这就是为什么 Liquibase 在数据库变更日志表中记录每个变更集条目的 md5 校验和,以检测变更日志中当前的内容与数据库实际运行的内容之间的差异。

    当您修改 authority.csv 时,变更集的校验和发生了变化,Liquibase 正确地抱怨了。

    因此,您有 3 种替代解决方案:

    1. 创建单独的变更集以仅插入您的新权限(生产中的首选方式)
    2. 在使用 DBeaver 等数据库客户端连接到数据库时清除变更集的校验和列,并删除 DATABASECHANGELOG 表中变更日志行的 MD5SUM 列。看https://docs.liquibase.com/concepts/basic/databasechangelog-table.html
    3. 删除您的数据库以从头开始重新启动,如果您不关心您的数据,这可能适用于开发数据库

    最后的建议:从official docsJHipster doc 了解有关 Liquibase 的更多信息

    【讨论】:

    • 我使用mvn clean 删除了我的数据库,但出现了一个新错误,有一个屏幕截图:ibb.co/0XhgYdG
    • 您的屏幕截图没有显示第一个错误,无论如何这应该是另一个问题,因为您的 liquibase 问题已解决。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-24
    • 2014-04-21
    相关资源
    最近更新 更多