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

micronaut-flyway does not work with PostgreSql when compiled to native (GraalVM) #540

Open
martinqcz opened this issue Mar 28, 2024 · 1 comment

Comments

@martinqcz
Copy link

Expected Behavior

I have following dependencies in build.gradle

implementation("io.micronaut.flyway:micronaut-flyway")
runtimeOnly("org.flywaydb:flyway-database-postgresql")

When I compile and run native code ./gradlew nativeRun I expect the application will start, run migrations and will be prepared to incomming requests.

Actual Behaviour

When the native compiled application starts it fails with Error:

22:32:19.923 [main] ERROR io.micronaut.runtime.Micronaut - Error starting Micronaut server: Bean definition [javax.sql.DataSource] could not be loaded: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class org.flywaydb.database.postgresql.PostgreSQLConfigurationExtension and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS)
io.micronaut.context.exceptions.BeanInstantiationException: Bean definition [javax.sql.DataSource] could not be loaded: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class org.flywaydb.database.postgresql.PostgreSQLConfigurationExtension and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS)
        at io.micronaut.context.DefaultBeanContext.initializeContext(DefaultBeanContext.java:2003)
        at io.micronaut.context.DefaultApplicationContext.initializeContext(DefaultApplicationContext.java:294)
        at io.micronaut.context.DefaultBeanContext.readAllBeanDefinitionClasses(DefaultBeanContext.java:3384)
        at io.micronaut.context.DefaultBeanContext.finalizeConfiguration(DefaultBeanContext.java:3739)
        at io.micronaut.context.DefaultBeanContext.start(DefaultBeanContext.java:363)
        at io.micronaut.context.DefaultApplicationContext.start(DefaultApplicationContext.java:202)
        at io.micronaut.runtime.Micronaut.start(Micronaut.java:74)
        at io.micronaut.runtime.Micronaut.run(Micronaut.java:328)
        at io.micronaut.runtime.Micronaut.run(Micronaut.java:303)
        at com.qapil.investiq.ApplicationKt.main(Application.kt:6)

If I downgrade the flyway-core to version 9.22.3 (by adding dependency implementation("org.flywaydb:flyway-core:9.22.3!!")) and compile again it starts to work again.

Steps To Reproduce

  1. Add dependencies to migronaut-flyway and flyway-database-postgresql
  2. start postgresql database and set datasource in application.properties to point to the postgresql database
  3. execute ./gradlew micronautRun

Environment Information

  • Operating system: macOS 14.4.1 (23E224)
  • JDK version: Oracle GraalVM 17.0.10+11.1 (build 17.0.10+11-LTS-jvmci-23.0-b27)

Example Application

No response

Version

4.3.6

@martinqcz martinqcz changed the title micronaut-flyway does not with PostgreSql when compiled to native (GraalVM) micronaut-flyway does not work with PostgreSql when compiled to native (GraalVM) Mar 28, 2024
@sdelamo
Copy link
Contributor

sdelamo commented Apr 11, 2024

@msupic can you look into this?

timyates added a commit to objectcomputing/check-ins that referenced this issue Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: No status
Development

No branches or pull requests

2 participants