Unable to resolve vue resources running Javalin from gradle distTar
See original GitHub issueHi
I’ve upgraded to javalin 5.
When I dist up my javalin server into a tarball (./gradlew clean check distTar
), extract it, run it and try and serve a page in non-dev mode, I see the following error:
[JettyServerThreadPool-25] WARN io.javalin.Javalin - Uncaught exception java.nio.file.NoSuchFileException: /vue at jdk.zipfs/jdk.nio.zipfs.ZipPath.getAttributes(ZipPath.java:742) at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.readAttributes(ZipFileSystemProvider.java:292) at java.base/java.nio.file.Files.readAttributes(Files.java:1764) at java.base/java.nio.file.FileTreeWalker.getAttributes(FileTreeWalker.java:219) at java.base/java.nio.file.FileTreeWalker.visit(FileTreeWalker.java:276) at java.base/java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:322) at java.base/java.nio.file.FileTreeIterator.<init>(FileTreeIterator.java:71) at java.base/java.nio.file.Files.walk(Files.java:3825) at io.javalin.vue.VuePathMaster.walkPaths(VuePathMaster.kt:21) at io.javalin.vue.VuePathMaster$cachedPaths$2.invoke(VuePathMaster.kt:18) at io.javalin.vue.VuePathMaster$cachedPaths$2.invoke(VuePathMaster.kt:18) at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74) at io.javalin.vue.VuePathMaster.getCachedPaths$javalin(VuePathMaster.kt:18) at io.javalin.vue.VueHandler.handle(VueHandler.kt:23) at io.javalin.routing.HandlerEntry.handle(HandlerEntry.kt:19) at io.javalin.http.servlet.DefaultTasks.HTTP$lambda-8$lambda-6$lambda-5(DefaultTasks.kt:38) at io.javalin.http.servlet.JavalinServlet.handleTask(JavalinServlet.kt:86) at io.javalin.http.servlet.JavalinServlet.handleSync(JavalinServlet.kt:53) at io.javalin.http.servlet.JavalinServlet.service(JavalinServlet.kt:41) at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:587) at io.javalin.jetty.JavalinJettyServlet.service(JavalinJettyServlet.kt:58) at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:587) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:764) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:529) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1571) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221) at io.javalin.jetty.JettyServer$start$wsAndHttpHandler$1.doHandle(JettyServer.kt:57) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:176) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:484) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1544) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:174) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1302) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129) at org.eclipse.jetty.server.handler.StatisticsHandler.handle(StatisticsHandler.java:173) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122) at org.eclipse.jetty.server.Server.handle(Server.java:563) at org.eclipse.jetty.server.HttpChannel.lambda$handle$0(HttpChannel.java:505) at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:762) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:497) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:282) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:314) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100) at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:933) at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1077) at java.base/java.lang.Thread.run(Thread.java:829)
I’ve been through new doco and examples to try and figure out what’s missing and I can see my app jar containing the vue resource dir therein referenced by the classpath in the gradle generated start script. I’m at somewhat of a loss as to why the vue resources are failing to resolve from the classpath when javalin needs to serve a VueComponent.
I whittled down one of the published javalin 5 examples into an example repo to illustrate the problem:
https://github.com/bensullivan/javalinvue-example
Any help/clues would be greatly appreciated.
Thanks!
Ben
Issue Analytics
- State:
- Created 10 months ago
- Comments:21 (11 by maintainers)
Top GitHub Comments
Thanks so much fellas - massive help!
Then it sounds like everything is working as expected. It’s hard for Javalin to automatically know where to look for resources in this case, which is why the class config exists.
I think we can close this now, and rather open a new issue if we want to try to improve this behavior.
Thanks @zugazagoitia, great work !