liquibase: Liquibase 4.0 problem when starting with jar

Environment

Liquibase Version: 4.0

Liquibase Integration & Version: Spring Boot 2.3

Liquibase Extension(s) & Version: N/A

Database Vendor & Version: PostgreSQL 11

Operating System Type & Version: Windows 10

Description

An issue was reported in JHipster’s project page that my own team is encountering as well: starting up a Spring Boot fat jar that contains Liquibase fails to conduct the database schema migrations due to an issue with there not being a file system available for the Spring Boot jar.

Steps To Reproduce

  • Create a Spring Boot fat jar that cointains Liquibase version 4.0.0.
  • Launch the Spring Boot application by running java -jar /path/to/springBootApp.jar

Actual Behavior

Liquibase fails to start due to a series of errors like the one below:

java.nio.file.FileSystemNotFoundException: null
	at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.getFileSystem(ZipFileSystemProvider.java:169)
	at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.getPath(ZipFileSystemProvider.java:155)
	at java.base/java.nio.file.Path.of(Path.java:208)
	at java.base/java.nio.file.Paths.get(Paths.java:97)
	at liquibase.resource.ClassLoaderResourceAccessor.loadRootPaths(ClassLoaderResourceAccessor.java:63)

Liquibase will encounter this error for each of the files within the fat jar, e.g.

  • “jar:file:/C:/path/to/foo.jar!/BOOT-INF/classes!/”
  • “jar:file:/C:/path/to/foo.jar!/BOOT-INF/lib/foo-api.jar!/”
  • “jar:file:/C:/path/to/foo.jar!/BOOT-INF/lib/foo-domain.jar!/”

Expected/Desired Behavior

Liquibase can start up normally.

Additional Context

This looks like a relevant posting from StackExchange regarding what may be the underlying cause.

┆Issue is synchronized with this Jira Bug by Unito ┆fixVersions: Liquibase 4.1.1

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 18
  • Comments: 28 (7 by maintainers)

Commits related to this issue

Most upvoted comments

We would appreciate if this bug could be fixed asap! Let us know if we can somehow help

Still reproduces on 4.1.0 version

Just tried 4.1.1. It works, but now it writes the issue description to stdout as a warning.

##      liquibase.com/support                     ##
##                                                ##
####################################################
Starting Liquibase at 16:00:55 (version 4.1.1 #10 built at 2020-10-12 19:24+0000)
[INFO] Executing on Database: jdbc:postgresql://localhost:5432/my-db?currentSchema=public
[INFO] Successfully acquired change log lock
[WARNING] Cannot create filesystem for url file:/Users/.../my-project/database/target/test-classes: /Users/.../my-project/database/target/test-classes
java.nio.file.NoSuchFileException: /Users/.../my-project/database/target/test-classes
    at jdk.nio.zipfs.ZipFileSystem.<init> (ZipFileSystem.java:160)
    at jdk.nio.zipfs.ZipFileSystemProvider.getZipFileSystem (ZipFileSystemProvider.java:125)
    at jdk.nio.zipfs.ZipFileSystemProvider.newFileSystem (ZipFileSystemProvider.java:120)
    at ja...
....
   at org.apache.maven.wrapper.WrapperExecutor.execute (WrapperExecutor.java:122)
    at org.apache.maven.wrapper.MavenWrapperMain.main (MavenWrapperMain.java:61)
[INFO] Reading from databasechangelog
[INFO] Successfully released change log lock
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  9.975 s
[INFO] Finished at: 2020-11-03T16:01:05+02:00
[INFO] ------------------------------------------------------------------------

macOS Catalina

java --version
openjdk 15.0.1 2020-10-20
OpenJDK Runtime Environment (build 15.0.1+9)
OpenJDK 64-Bit Server VM (build 15.0.1+9, mixed mode, sharing)

Hi, @RainerGanss ! See my edited comment above to resolve the issue.

➤ Robert Reeves commented:

From Alexandru Slobodcicov:

{quote}Doesn’t look to be fixed, it does the migrations however a lot of exceptions in the logs.

java.nio.file.FileSystemNotFoundException at com.sun.nio.zipfs.ZipFileSystemProvider.getFileSystem(ZipFileSystemProvider.java:171) at com.sun.nio.zipfs.ZipFileSystemProvider.getPath(ZipFileSystemProvider.java:157)

Please have a look at the quickstart application where you can easily test both: 3.10.2 and 4.1.1 the default one.

https://github.com/alexandru-slobodcicov/liquibase-nosql-quickstart ( https://github.com/alexandru-slobodcicov/liquibase-nosql-quickstart|smart-link ) {quote}

➤ Erzsebet Carmean commented:

Liquibase 4.1.1-SNAPSHOTValidated bug repro using 4.1.0 with an XML changelog.Verify there are no file system not found errors during app startup. PASS

  • XML PASS
  • Formatted SQL PASS
  • YAML PASS
  • JSON PASS

Everything looks good here, Nathan.

Hi @severn-everett Thanks for writing up this issue. We will add this to the list of issues that we are reviewing.

Thanks, we’ll have to take a look.