将Hawkbit与MariaDB连接时如何解决错误?

时间:2019-05-20 03:25:46

标签: mysql mariadb hawkbit

我正在尝试按照以下指南配置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/

如何解决这个问题?

1 个答案:

答案 0 :(得分: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服务器。