0

我正在尝试按照本指南配置 Hawkbit:https ://www.eclipse.org/hawkbit/guides/runhawkbit/

  • 在 pom.xml 中:
<dependency>
  <groupId>org.mariadb.jdbc</groupId>
  <artifactId>mariadb-java-client</artifactId>
  <scope>compile</scope>
</dependency>
  • 在 application.properties 中:
spring.jpa.database=MYSQL
spring.datasource.url=jdbc:mysql://localhost:3306/{SCHEMA_NAME}
spring.datasource.username={USER_NAME}
spring.datasource.password={PWD}
spring.datasource.driverClassName=org.mariadb.jdbc.Driver

但我收到了这个错误:https ://paste.ubuntu.com/p/YDtFKxF4Vv/

如何解决这个问题?

4

1 回答 1

0

可能有点晚了,但基本上 Hawkbit 服务器有数据库迁移脚本(Flyway)。在 HawkBit 数据库中,保留了一个表用于跟踪这些迁移以实现向后兼容性。这是schema_version桌子。

您在此处看到的问题是 Flyway 正在尝试迁移数据库的状态,但由于检测到先前的迁移失败而失败。

Caused by: org.flywaydb.core.api.FlywayException: Validate failed: Detected failed migration to version 1.0.1 (init   )
    at org.flywaydb.core.Flyway.doValidate(Flyway.java:1482)
    at org.flywaydb.core.Flyway.access$100(Flyway.java:85)
    at org.flywaydb.core.Flyway$1.execute(Flyway.java:1364)
    at org.flywaydb.core.Flyway$1.execute(Flyway.java:1356)
    at org.flywaydb.core.Flyway.execute(Flyway.java:1711)
    at org.flywaydb.core.Flyway.migrate(Flyway.java:1356)
    at org.springframework.boot.autoconfigure.flyway.FlywayMigrationInitializer.afterPropertiesSet(FlywayMigrationInitializer.java:66)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1837)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1774)
    ... 98 common frames omitted

最简单的解决方案是从一个新的数据库开始。如果您在数据库中有重要数据,您也可以截断schema_version表并重新运行 Hawkbit 服务器。

于 2020-01-22T16:59:42.967 回答