简体   繁体   中英

How to resolve error when connect Hawkbit with MariaDB?

I'm trying to config Hawkbit following this guide: https://www.eclipse.org/hawkbit/guides/runhawkbit/

  • In pom.xml:
<dependency>
  <groupId>org.mariadb.jdbc</groupId>
  <artifactId>mariadb-java-client</artifactId>
  <scope>compile</scope>
</dependency>
  • In 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

But I got this error: https://paste.ubuntu.com/p/YDtFKxF4Vv/

How to resolve this?

Might be a bit late, but basically the Hawkbit server has database migration scripts (Flyway). Within the HawkBit database, there is a table reserved for tracking these migrations for backwards compatibility. This is the schema_version table.

The problem that you see here is that Flyway is trying to migrate the state of the database, but fails because it detects a previous migration that failed.

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

Easiest solution would be to start with a fresh database. But in the case that you have important data in the database, you could also truncate the schema_version table and rerun the Hawkbit server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM