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

如何解决呢?

最佳答案

可能会晚一点,但是基本上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服务器。

关于mysql - 将Hawkbit与MariaDB连接时如何解决错误?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/56213957/

10-12 12:50