FlywayException : Unsupported Database: MariaDB 10.5
Asked Answered
E

1

6
  • mariadb version is Server version: 10.5.9-MariaDB Homebrew
  • Flyway version is "org.flywaydb" % "flyway-core" % "8.2.1"
  • HikariCP version is "com.zaxxer" % "HikariCP" % "5.0.1"
  • Mariadb jdbc client versionis "org.mariadb.jdbc" % "mariadb-java-client" % "2.7.5",

It is a spring boot application and when i start the application i get the following error

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#104ea6e1': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Invocation of init method failed; nested exception is org.flywaydb.core.api.FlywayException: Unsupported Database: MariaDB 10.5
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:342)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:113)
    at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:693)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:510)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:374)
    ... 175 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Invocation of init method failed; nested exception is org.flywaydb.core.api.FlywayException: Unsupported Database: MariaDB 10.5
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1804)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:330)
    ... 183 more
Caused by: org.flywaydb.core.api.FlywayException: Unsupported Database: MariaDB 10.5
    at org.flywaydb.core.internal.database.DatabaseTypeRegister.getDatabaseTypeForConnection(DatabaseTypeRegister.java:106)
    at org.flywaydb.core.internal.jdbc.JdbcConnectionFactory.<init>(JdbcConnectionFactory.java:75)
    at org.flywaydb.core.FlywayExecutor.execute(FlywayExecutor.java:143)
    at org.flywaydb.core.Flyway.migrate(Flyway.java:124)
    at org.springframework.boot.autoconfigure.flyway.FlywayMigrationInitializer.afterPropertiesSet(FlywayMigrationInitializer.java:66)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800)
    ... 192 more

The flyway-core version from 8.2.1 and above is giving me the same error.

The latest version of flyway-core is 8.4.3. Based on the below link

https://mvnrepository.com/artifact/org.flywaydb/flyway-core

I also tried upgrading mariadb-java-client to the latest version which is 3.0.3

https://mvnrepository.com/artifact/org.mariadb.jdbc/mariadb-java-client

But when the version of flyway-core is downgraded to 8.2.0 , it works

"org.flywaydb" % "flyway-core" % "8.2.0",

I have also gone through the following link in flyway documentation

https://flywaydb.org/documentation/database/mariadb

Does it mean the support of flyway is supported only till mariadb 10.4 version ?

Any suggestions/ help

Effervesce answered 31/1, 2022 at 9:11 Comment(0)
T
23

From Flyway 8.2.1, both MySQL and MariaDB database support has been part of a separate dependency, flyway-mysql. See https://flywaydb.org/documentation/database/mysql#java-usage

If you include that on your classpath the DatabaseTypeRegister should be able to pick up the support for MariaDB.

Togetherness answered 31/1, 2022 at 11:27 Comment(2)
God I want my old Flyway back where things just worked... :(Palladin
This is the link to the documentation. documentation.red-gate.com/flyway/flyway-cli-and-api/…Coleridge

© 2022 - 2024 — McMap. All rights reserved.