mvysny / vaadin-boot-example-maven Goto Github PK
View Code? Open in Web Editor NEWVaadin example app running in Embedded Jetty
License: The Unlicense
Vaadin example app running in Embedded Jetty
License: The Unlicense
Along the zip file, also create a jar-with-dependencies as described at https://www.baeldung.com/executable-jar-with-maven .
Akin to Spring Boot, the jar would contain other jars as dependencies packaged inside. That solves the limitations of uberjar (unpack all dependencies then zip it into one huge jar) which disallows duplicate resources (such as META-INF/MANIFEST.MF
and service loader config files).
When I try to run it using the uberjar it fails with this:
500
java.lang.NullPointerException: Cannot invoke "com.vaadin.flow.server.StaticFileHandler.serveStaticResource(jakarta.servlet.http.HttpServletRequest, jakarta.servlet.http.HttpServletResponse)" because "this.staticFileHandler" is null
com.vaadin.flow.server.VaadinServlet-34b7bfc0
java.lang.NullPointerException: Cannot invoke "com.vaadin.flow.server.StaticFileHandler.serveStaticResource(jakarta.servlet.http.HttpServletRequest, jakarta.servlet.http.HttpServletResponse)" because "this.staticFileHandler" is null
java.lang.NullPointerException: Cannot invoke "com.vaadin.flow.server.StaticFileHandler.serveStaticResource(jakarta.servlet.http.HttpServletRequest, jakarta.servlet.http.HttpServletResponse)" because "this.staticFileHandler" is null
at com.vaadin.flow.server.VaadinServlet.serveStaticOrWebJarRequest(VaadinServlet.java:431)
at com.vaadin.flow.server.VaadinServlet.service(VaadinServlet.java:386)
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.handle(ScopedHandler.java:131)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:578)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:223)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1570)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1382)
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:1543)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:174)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1304)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129)
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:936)
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1080)
at java.base/java.lang.Thread.run(Thread.java:1589)
Hey, some test is failing for me, any ideas why?
I am using a modifed version of this example which you can find here: https://github.com/Osiris-Team/vaadin-boot-example-1jpm
However I compared the pom.xml files and they should be pretty similar still.
Can you reproduce this issue on the original vaadin-boot-example-maven repo?
No version provided. This might cause issues. Dependency: com.vaadin:vaadin-core
No version provided. This might cause issues. Dependency: javax.annotation:javax.annotation-api
No version provided. This might cause issues. Dependency: com.vaadin:flow-server-production-mode
No version provided. This might cause issues. Dependency: com.vaadin:vaadin-core
No version provided. This might cause issues. Dependency: com.vaadin:vaadin-dev
No version provided. This might cause issues. Dependency: com.vaadin:vaadin-maven-plugin
Generated pom.xml file.
Executing: D:\Coding\JAVA\vaadin-boot-example-1jpm\mvnw.cmd clean package
Found "D:\Coding\JAVA\vaadin-boot-example-1jpm\.mvn\wrapper\maven-wrapper.jar"
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------< com.example:vaadin-boot-example-maven >----------------
[INFO] Building vaadin-boot-example-maven 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ vaadin-boot-example-maven ---
[INFO] Deleting D:\Coding\JAVA\vaadin-boot-example-1jpm\target
[INFO]
[INFO] --- maven-enforcer-plugin:3.3.0:enforce (enforce) @ vaadin-boot-example-maven ---
[INFO] Rule 0: org.apache.maven.enforcer.rules.dependency.DependencyConvergence passed
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ vaadin-boot-example-maven ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 3 resources
[INFO]
[INFO] >>> vaadin-maven-plugin:24.4.7:prepare-frontend (default) > :configure @ vaadin-boot-example-maven >>>
[INFO]
[INFO] --- vaadin-maven-plugin:24.4.7:configure (configure) @ vaadin-boot-example-maven ---
[INFO] Reflections took 681 ms to scan 155 urls, producing 5301 keys and 29980 values
[WARNING] The 'configure' goal is only meant to be used in Hilla projects with endpoints.
[INFO]
[INFO] <<< vaadin-maven-plugin:24.4.7:prepare-frontend (default) < :configure @ vaadin-boot-example-maven <<<
[INFO]
[INFO]
[INFO] --- vaadin-maven-plugin:24.4.7:prepare-frontend (default) @ vaadin-boot-example-maven ---
[INFO] Reflections took 185 ms to scan 155 urls, producing 5301 keys and 29980 values
[ERROR] Command '[C:\Users\arman\AppData\Roaming\npm\npm.cmd, -v]' failed with exit code '1'
[INFO] Reflections took 291 ms to scan 155 urls, producing 5301 keys and 29980 values
[INFO] Reflections took 130 ms to scan 155 urls, producing 5301 keys and 29980 values
[INFO] Visited 93 classes. Took 140 ms.
[INFO] Copying frontend resources from jar files ...
[INFO] Visited 155 resources. Took 917 ms.
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ vaadin-boot-example-maven ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 5 source files to D:\Coding\JAVA\vaadin-boot-example-1jpm\target\classes
[INFO] /D:/Coding/JAVA/vaadin-boot-example-1jpm/src/main/java/JPM.java: D:\Coding\JAVA\vaadin-boot-example-1jpm\src\main\java\JPM.java verwendet oder �berschreibt eine veraltete API.
[INFO] /D:/Coding/JAVA/vaadin-boot-example-1jpm/src/main/java/JPM.java: Wiederholen Sie die Kompilierung mit -Xlint:deprecation, um Details zu erhalten.
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ vaadin-boot-example-maven ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\Coding\JAVA\vaadin-boot-example-1jpm\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ vaadin-boot-example-maven ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to D:\Coding\JAVA\vaadin-boot-example-1jpm\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ vaadin-boot-example-maven ---
[INFO] Surefire report directory: D:\Coding\JAVA\vaadin-boot-example-1jpm\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.vaadin.starter.skeleton.MainViewTest
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.03 sec <<< FAILURE!
com.vaadin.starter.skeleton.MainViewTest.testGreeting() Time elapsed: 0.029 sec <<< FAILURE!
java.lang.IllegalStateException: UI.getCurrent() is null. Have you called MockVaadin.setup()?
at com.github.mvysny.kaributesting.v10.UtilsKt.getCurrentUI(Utils.kt:132)
at com.github.mvysny.kaributesting.v10.LocatorKt._get(Locator.kt:183)
at com.github.mvysny.kaributesting.v10.LocatorJ._get(LocatorJ.java:48)
at com.vaadin.starter.skeleton.MainViewTest.testGreeting(MainViewTest.java:73)
Results :
Failed tests: com.vaadin.starter.skeleton.MainViewTest.testGreeting(): UI.getCurrent() is null. Have you called MockVaadin.setup()?
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.409 s
[INFO] Finished at: 2024-08-04T00:00:48+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project vaadin-boot-example-maven: There are test failures.
[ERROR]
[ERROR] Please refer to D:\Coding\JAVA\vaadin-boot-example-1jpm\target\surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Exception in thread "main" java.lang.RuntimeException: Maven (mvnw.cmd) finished with an error (1): D:\Coding\JAVA\vaadin-boot-example-1jpm\mvnw.cmd
at JPM.executeMaven(JPM.java:145)
at ThisProject.main(JPM.java:89)
Process finished with exit code 1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.