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

Flyway 8.1.0 with SQL Server fails in native with NullPointerException #21835

Closed
jsmrcka opened this issue Dec 1, 2021 · 1 comment · Fixed by #21836
Closed

Flyway 8.1.0 with SQL Server fails in native with NullPointerException #21835

jsmrcka opened this issue Dec 1, 2021 · 1 comment · Fixed by #21836
Assignees
Labels
area/flyway kind/bug Something isn't working
Milestone

Comments

@jsmrcka
Copy link
Contributor

jsmrcka commented Dec 1, 2021

Describe the bug

Flyway 8.1.0 together with SQL Server fails on native application startup, throwing a NPE due to a missing resource:

org/flywaydb/database/version.txt

POM dependencies sample:

    ...
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-flyway</artifactId>
    </dependency>
    <dependency>
      <groupId>org.flywaydb</groupId>
      <artifactId>flyway-sqlserver</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-jdbc-mssql</artifactId>
    </dependency>
    ...

Workaround: explicitly include the missing resource in application.properties:

quarkus.native.resources.includes=org/flywaydb/database/version.txt

Expected behavior

No NullPointerException on startup.

Actual behavior

2021-12-01 07:54:02,142 INFO  [org.fly.cor.int.lic.VersionPrinter] (main) Flyway Community Edition 8.1.0 by Redgate
2021-12-01 07:54:02,144 ERROR [io.qua.run.Application] (main) Failed to start application (with profile prod): java.lang.NullPointerException
	at org.flywaydb.core.internal.util.FileCopyUtils.copy(FileCopyUtils.java:121)
	at org.flywaydb.core.internal.util.FileCopyUtils.copyToString(FileCopyUtils.java:81)
	at org.flywaydb.database.SQLServerDatabaseExtension.readVersion(SQLServerDatabaseExtension.java:32)
	at org.flywaydb.database.SQLServerDatabaseExtension.getDescription(SQLServerDatabaseExtension.java:27)
	at org.flywaydb.core.internal.license.VersionPrinter.printExtensionVersions(VersionPrinter.java:61)
	at org.flywaydb.core.internal.license.VersionPrinter.printVersionOnly(VersionPrinter.java:56)
	at org.flywaydb.core.internal.license.VersionPrinter.printVersion(VersionPrinter.java:51)
	at org.flywaydb.core.FlywayExecutor.execute(FlywayExecutor.java:170)
	at org.flywaydb.core.Flyway.migrate(Flyway.java:124)
	at io.quarkus.flyway.runtime.FlywayRecorder.doStartActions(FlywayRecorder.java:76)
	at io.quarkus.deployment.steps.FlywayProcessor$createBeansAndStartActions2063183959.deploy_0(Unknown Source)
	at io.quarkus.deployment.steps.FlywayProcessor$createBeansAndStartActions2063183959.deploy(Unknown Source)
	at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)
	at io.quarkus.runtime.Application.start(Application.java:101)
	at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:104)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:67)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:41)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:120)
	at io.quarkus.runner.GeneratedMain.main(Unknown Source)

How to Reproduce?

flyway-sqlserver-reproducer.zip

Use the attached reproducer.

unzip flyway-sqlserver-reproducer.zip
cd flyway-sqlserver-reproducer

Build Quarkus main (2.6 - main) or configure Maven to use a repository with daily snapshot.
Then run:

./mvnw clean verify -Pnative

Output of uname -a or ver

No response

Output of java -version

openjdk version "11.0.11" 2021-04-20 OpenJDK Runtime Environment AdoptOpenJDK-11.0.11+9 (build 11.0.11+9) OpenJDK 64-Bit Server VM AdoptOpenJDK-11.0.11+9 (build 11.0.11+9, mixed mode)

GraalVM version (if different from Java)

GraalVM 21.2.0 Java 16 CE (Java Version 16.0.2+7-jvmci-21.2-b08)

Quarkus version or git rev

999-SNAPSHOT (2.6 - main)

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.8.3

Additional information

No response

@jsmrcka jsmrcka added the kind/bug Something isn't working label Dec 1, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Dec 1, 2021

/cc @cristhiank, @gastaldi, @geoand, @gsmet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/flyway kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants