Getting following error after upgrading from springboot 2.7.18 to 3.2.2. We are directly using Launcher class reference in our project and we changed the reference from org.springframework.boot.loader.JarLauncher to org.springframework.boot.loader.launch.JarLauncher. We saw this error while trying to access static resources from a jar.

Unable to unpack file at path jar:nested:/opt/some/path/jar1.jar/!BOOT-INF/lib/jar2.jar!/another/path

While debugging, if I changed the path to the format jar:nested:/opt/some/path/jar1.jar!/BOOT-INF/lib/jar2.jar!/another/path, it started working.

Switching back to the CLASSIC loader resolved the issue temporarily.

Providing stack trace of the error that we saw :

io.vertx.core.VertxException: Unable to unpack file at path 'jar:nested:/some/path/jar1.jar/!BOOT-INF/lib/jar2.jar!/another/path'
2024-03-05 14:43:03 at io.vertx.core.file.impl.FileResolverImpl.unpackFromJarURL(FileResolverImpl.java:334)
2024-03-05 14:43:03 at io.vertx.core.file.impl.FileResolverImpl.unpackUrlResource(FileResolverImpl.java:239)
2024-03-05 14:43:03 at io.vertx.core.file.impl.FileResolverImpl.resolveFile(FileResolverImpl.java:162)
2024-03-05 14:43:03 at io.vertx.core.impl.VertxImpl.resolveFile(VertxImpl.java:829)
2024-03-05 14:43:03 at io.vertx.core.file.impl.FileSystemImpl$20.perform(FileSystemImpl.java:1135)
2024-03-05 14:43:03 at io.vertx.core.file.impl.FileSystemImpl$20.perform(FileSystemImpl.java:1133)
2024-03-05 14:43:03 at io.vertx.core.file.impl.FileSystemImpl$BlockingAction.handle(FileSystemImpl.java:1174)
2024-03-05 14:43:03 at io.vertx.core.file.impl.FileSystemImpl$BlockingAction.handle(FileSystemImpl.java:1156)
2024-03-05 14:43:03 at io.vertx.core.impl.ContextBase.lambda$executeBlocking$1(ContextBase.java:180)
2024-03-05 14:43:03 at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:277)
2024-03-05 14:43:03 at io.vertx.core.impl.ContextBase.lambda$internalExecuteBlocking$2(ContextBase.java:199)
2024-03-05 14:43:03 at io.vertx.core.impl.TaskQueue.run(TaskQueue.java:76)
2024-03-05 14:43:03 at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
2024-03-05 14:43:03 at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
2024-03-05 14:43:03 at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
2024-03-05 14:43:03 at java.base/java.lang.Thread.run(Unknown Source)
2024-03-05 14:43:03 Caused by: java.nio.file.NoSuchFileException: d:/some/path/jar1.jar/!BOOT-INF/lib/jar2.jar
2024-03-05 14:43:03 at java.base/sun.nio.fs.UnixException.translateToIOException(Unknown Source)
2024-03-05 14:43:03 at java.base/sun.nio.fs.UnixException.rethrowAsIOException(Unknown Source)
2024-03-05 14:43:03 at java.base/sun.nio.fs.UnixException.rethrowAsIOException(Unknown Source)
2024-03-05 14:43:03 at java.base/sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes(Unknown Source)
2024-03-05 14:43:03 at java.base/sun.nio.fs.UnixFileSystemProvider.readAttributes(Unknown Source)
2024-03-05 14:43:03 at java.base/sun.nio.fs.LinuxFileSystemProvider.readAttributes(Unknown Source)
2024-03-05 14:43:03 at java.base/java.nio.file.Files.readAttributes(Unknown Source)
2024-03-05 14:43:03 at java.base/java.util.zip.ZipFile$Source.get(Unknown Source)
2024-03-05 14:43:03 at java.base/java.util.zip.ZipFile$CleanableResource.<init>(Unknown Source)
2024-03-05 14:43:03 at java.base/java.util.zip.ZipFile.<init>(Unknown Source)
2024-03-05 14:43:03 at java.base/java.util.zip.ZipFile.<init>(Unknown Source)
2024-03-05 14:43:03 at java.base/java.util.zip.ZipFile.<init>(Unknown Source)
2024-03-05 14:43:03 at io.vertx.core.file.impl.FileResolverImpl.unpackFromJarURL(FileResolverImpl.java:298)

Comment From: wilkinsona

Vertx is making an assumption about the structure of jar: URLs that doesn't hold true with the new loader. The syntax for a jar: URL is jar:<url>!/{entry}. In other words, any legal URL can appear between jar: at the start and !/{entry} at the end. In your example above, this inner URL is nested:/opt/some/path/jar1.jar/!BOOT-INF/lib/jar2.jar.

For you to be able to use the new loader, Vertx will have to be fixed to handle a broader range of legal jar: URLs.