Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrading to flyway 10.0.0 (from 9.22.3) causes Spring Boot flywayInitializer to fail for MySQL 8.0.32 #3777

Closed
fraggerfox opened this issue Nov 1, 2023 · 8 comments
Labels
s: blocked Blocked on 3rd party work

Comments

@fraggerfox
Copy link

fraggerfox commented Nov 1, 2023

Which version and edition of Flyway are you using?

Community 10.0.0

If this is not the latest version, can you reproduce the issue with the latest one as well? (Many bugs are fixed in newer releases and upgrading will often resolve the issue)

This is the latest version.

Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin)

Gradle plugin and Java API (through Spring Boot).

Plugin seems to work, the API is failing.

Which database are you using? (Type & version)

MySQL 8.0.32

Which operating system are you using?

MacOS / Linux (Build fails in both due to the same reason)

What did you do? (Please include the content causing the issue, any relevant configuration settings, the SQL statement(s) that failed (if any), and the command you ran)

Updated the library from 9.22.3 to 10.0.0 in the Spring Boot application.

There were no changes other than bumping the following flyway dependencies to 10.0.0 from 9.22.3

  • org.flywaydb:flyway-mysql
  • org.flywaydb:flyway-core
  • org.flywaydb.flyway (plugin)

Switching the library back to 9.22.3 makes the application run as expected.

What did you expect to see?

The Spring Boot application runs as expected without any failures after updating Flyway to 10.0.0.

What did you see instead?

When trying to run the tests from the application, it fails with the following message.

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]: Receiver class org.flywaydb.database.mysql.MySQLDatabase does not define or inherit an implementation of the resolved method 'abstract void ensureSupported()' of abstract class org.flywaydb.core.internal.database.base.Database.

further below

Caused by: java.lang.AbstractMethodError: Receiver class org.flywaydb.database.mysql.MySQLDatabase does not define or inherit an implementation of the resolved method 'abstract void ensureSupported()' of abstract class org.flywaydb.core.internal.database.base.Database.
	at org.flywaydb.core.FlywayExecutor.execute(FlywayExecutor.java:181)

Reference to the mentioned class path resource

@JasonLuo-Redgate
Copy link

Hi @fraggerfox , have you tried the proposed action in #3780?

@fraggerfox
Copy link
Author

fraggerfox commented Nov 1, 2023

@JasonLuo-Redgate : The part of the gradle configuration using flyway looks like this

dependencies {
    compileOnly("org.flywaydb:flyway-core:10.0.0")
    implementation("org.flywaydb:flyway-mysql:10.0.0")
}

buildscript {
    dependencies {
        classpath("org.flywaydb:flyway-mysql:10.0.0")
    }
}

This is how it was working with 9.22.3, I tried changing these by explicitly adding class path for flyway-core and also changing compileOnly() to implementation() but that also did not help.

Let me know if I missed out any steps in the proposed action.

@JasonLuo-Redgate
Copy link

You might need to include a dependency on the flyway-mysql module as stated in #3780

@fraggerfox
Copy link
Author

@JasonLuo-Redgate : You are right and that is also what I did, the following change was done

dependencies {
    implementation("org.flywaydb:flyway-core:10.0.0")
    implementation("org.flywaydb:flyway-mysql:10.0.0")
}

but I did not notice the error had changed to.

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.flywaydb.core.Flyway]: Factory method 'flyway' threw exception with message: 'org.flywaydb.core.api.configuration.FluentConfiguration org.flywaydb.core.api.configuration.FluentConfiguration.licenseKey(java.lang.String)'

This seems to be an issue with Spring Boot, an issue has been opened at their end for this

spring-projects/spring-boot#38164

The issue is now similar to #3781

@JasonLuo-Redgate JasonLuo-Redgate added s: blocked Blocked on 3rd party work and removed s: waiting for feedback labels Nov 2, 2023
@sergiolinares
Copy link

@fraggerfox check if you have declared the org.flywaydb:flyway-mysql library somewhere else in your configuration file with version 9.22.3, the problem comes from the fact that it's not available for Flyway at runtime because it continues to use the old version to the connection to MySQL.

@fraggerfox
Copy link
Author

@sergiolinares I checked and there isn't, all references have been updated to use 10.0.0, but like the exception message says, the licenseKey method is missing, which matches with the spring boot issue reported.

Let me know if I am overlooking something at my end here.

@JasonLuo-Redgate
Copy link

The Sprint boot ticket is now fixed spring-projects/spring-boot#38164

@fraggerfox
Copy link
Author

They have not made a release yet, but for now this ticket can be closed.

Once they do a release I shall update at my end and if there are any problems, will open a new issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s: blocked Blocked on 3rd party work
Projects
None yet
Development

No branches or pull requests

3 participants