-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Unable to load resources from webjars and MVNPM in dev mode in 3.7.1 #38576
Comments
Thanks for reporting. I'm not qualified to investigate but will try to find someone who is. I'm not sure who maintains this module... history would suggest @phillip-kruger maybe? @majlantalik also made a change recently. Also, @geoand @gsmet I'm really not sure how to tag this one; should we add a |
I think @cescoffier is looking at this. A.f.a.i.k it's in vertx |
Do you u have the stack trace or a reproducer? I do not believe my fix is related to - in names, but was working around some weird error in the JDK Jar api |
I created a new project from code start. You can get it here: https://github.com/itatdcer/webjars-error-reproducer You can change in pom.xml the platform version between 3.6.3 (works) and 3.7.1 (error). Just access the index.html page and check network error getting the cc file. The stack trace: 2024-02-05 08:43:04,353 INFO [io.quarkus] (Quarkus Main Thread) Installed features: [cdi, qute, resteasy-reactive, resteasy-reactive-jackson, smallrye-context-propagation, vertx, webjars-locator]
2024-02-05 08:43:23,153 ERROR [io.qua.ver.htt.run.QuarkusErrorHandler] (vert.x-eventloop-thread-1) HTTP Request to /webjars/bootstrap-icons/1.11.2/font/bootstrap-icons.css failed, error id: 6045c762-c13d-4a9c-9e6b-1a5d242352d3-1: io.vertx.core.VertxException: Unable to unpack file at path 'jar:file:///home/seseso/.m2/repository/org/webjars/npm/bootstrap-icons/1.11.2/bootstrap-icons-1.11.2.jar!/META-INF/resources/webjars/bootstrap-icons/1.11.2/font'
at io.vertx.core.file.impl.FileResolverImpl.unpackFromJarURL(FileResolverImpl.java:360)
at io.vertx.core.file.impl.FileResolverImpl.unpackUrlResource(FileResolverImpl.java:247)
at io.vertx.core.file.impl.FileResolverImpl.resolveFile(FileResolverImpl.java:170)
at io.vertx.core.impl.VertxImpl.resolveFile(VertxImpl.java:929)
at io.vertx.core.file.impl.FileSystemImpl$20.perform(FileSystemImpl.java:1135)
at io.vertx.core.file.impl.FileSystemImpl$20.perform(FileSystemImpl.java:1133)
at io.vertx.core.file.impl.FileSystemImpl$BlockingAction.handle(FileSystemImpl.java:1174)
at io.vertx.core.file.impl.FileSystemImpl$BlockingAction.handle(FileSystemImpl.java:1156)
at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$1(ContextImpl.java:190)
at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:276)
at io.vertx.core.impl.ContextImpl.lambda$internalExecuteBlocking$2(ContextImpl.java:209)
at io.vertx.core.impl.TaskQueue.run(TaskQueue.java:76)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.io.FileNotFoundException: JAR entry META-INF/resources/webjars/bootstrap-icons/1.11.2/font not found in /home/seseso/.m2/repository/org/webjars/npm/bootstrap-icons/1.11.2/bootstrap-icons-1.11.2.jar
at java.base/sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:146)
at java.base/sun.net.www.protocol.jar.JarURLConnection.getJarFile(JarURLConnection.java:92)
at io.vertx.core.file.impl.FileResolverImpl.unpackFromJarURL(FileResolverImpl.java:320)
... 18 more |
thanks! At least, the exception looks the same, so, my fix should work (trying now). @vietj here is another reproducer. |
This is indeed a serious problem as @cescoffier and I encountered in on Friday while we also had someone report something similar in Zulip |
My fix works, but I'm not sure it's totally correct. It looks very weird, and I am unable to reproduce it in a pure vertx setup. |
So... it's a classloading issue or some friction between the Quarkus classloader used in dev (the prod classloader is different and does not trigger the problem - to be validated) and Vert.x. |
So, the issue is that in dev mode, the Quarkus classloader provides URLs for directories found in Jar files. However, Jar Files do not include directories, which means that if the FileResolver from Vert.x tries to open that URL, it fails. I've opened a PR in Vert.x to make the code more robust and detect this case. |
My Vert.x fix has been merged (well, the second rewrite of the fix). Waiting for the vert.x release. |
Thanks a ton @cescoffier! |
I should add that it's not a "pure" Vert.x issue, it's a joint responsibility between Quarkus (having a classloader returning URLs for directories) and Vert.x. We decided that fixing it in Vert.x was easier and safer. |
Great call! |
The only detected breaking changes are related to the vertx-mutiny-http-proxy module which is not used in Quarkus. Full release notes are there: https://github.com/vert-x3/wiki/wiki/4.5.3-Release-Notes. Important: - Fix CVE-2024-1300 io.vertx:vertx-core: memory leak when a TCP server is configured with TLS and SNI support - Fix the classloading issue for NVMPN and WebJars in dev mode (quarkusio#38576)
The only detected breaking changes are related to the vertx-mutiny-http-proxy module which is not used in Quarkus. Full release notes are there: https://github.com/vert-x3/wiki/wiki/4.5.3-Release-Notes. Important: - Fix CVE-2024-1300 io.vertx:vertx-core: memory leak when a TCP server is configured with TLS and SNI support - Fix the classloading issue for NVMPN and WebJars in dev mode (quarkusio#38576)
Closed with the vert.x upgrade |
The only detected breaking changes are related to the vertx-mutiny-http-proxy module which is not used in Quarkus. Full release notes are there: https://github.com/vert-x3/wiki/wiki/4.5.3-Release-Notes. Important: - Fix CVE-2024-1300 io.vertx:vertx-core: memory leak when a TCP server is configured with TLS and SNI support - Fix the classloading issue for NVMPN and WebJars in dev mode (quarkusio#38576) (cherry picked from commit 7bcbb99)
Describe the bug
Using webjars where the artifactId has a dash stopped working in Quarkus 3.7.1. It worked with previous versions.
Expected behavior
Serve static resoyrec as excpeted
Actual behavior
Content not found
How to Reproduce?
In maven, declare:
In a html file, use:
<link rel="stylesheet" media="screen" href="/webjars/bootstrap-icons/font/bootstrap-icons.css" />
Output of
uname -a
orver
No response
Output of
java -version
No response
Quarkus version or git rev
No response
Build tool (ie. output of
mvnw --version
orgradlew --version
)No response
Additional information
No response
The text was updated successfully, but these errors were encountered: