flow icon indicating copy to clipboard operation
flow copied to clipboard

Production JAR not running on a folder with space

Open tarekoraby opened this issue 1 year ago • 2 comments

Description of the bug

Running a production JAR of a Flow app on a folder with spaces fails with the following error:

2024-01-12T09:22:42.113+02:00  INFO 207100 --- [           main] org.vaadin.example.Application           : Starting Application v1.0-SNAPSHOT using Java 21.0.1 with PID 207100 (C:\folder with space\skeleton-starter-flow-spring-24\target\spring-skeleton-1.0-SNAPSHOT.jar started by Tarek Oraby in C:\folder with space\skeleton-starter-flow-spring-24)
2024-01-12T09:22:42.115+02:00  INFO 207100 --- [           main] org.vaadin.example.Application           : No active profile set, falling back to 1 default profile: "default"
2024-01-12T09:22:43.438+02:00  INFO 207100 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port 8080 (http)
2024-01-12T09:22:43.447+02:00  INFO 207100 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2024-01-12T09:22:43.447+02:00  INFO 207100 --- [           main] o.apache.catalina.core.StandardEngine    : Starting Servlet engine: [Apache Tomcat/10.1.16]
2024-01-12T09:22:43.491+02:00  INFO 207100 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2024-01-12T09:22:43.493+02:00  INFO 207100 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1276 ms
2024-01-12T09:22:43.608+02:00 ERROR 207100 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Exception sending context initialized event to listener instance of class [com.vaadin.flow.spring.VaadinServletContextInitializer$CompositeServletContextListener]

java.lang.RuntimeException: Unable to initialize com.vaadin.flow.spring.VaadinServletContextInitializer$VaadinAppShellContextListener
        at com.vaadin.flow.spring.VaadinServletContextInitializer$FailFastServletContextListener.contextInitialized(VaadinServletContextInitializer.java:199) ~[vaadin-spring-24.3.2.jar!/:na]
        at com.vaadin.flow.spring.VaadinServletContextInitializer$CompositeServletContextListener.lambda$contextInitialized$0(VaadinServletContextInitializer.java:223) ~[vaadin-spring-24.3.2.jar!/:na]
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1596) ~[na:na]
        at com.vaadin.flow.spring.VaadinServletContextInitializer$CompositeServletContextListener.contextInitialized(VaadinServletContextInitializer.java:223) ~[vaadin-spring-24.3.2.jar!/:na]
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4420) ~[tomcat-embed-core-10.1.16.jar!/:na]
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4860) ~[tomcat-embed-core-10.1.16.jar!/:na]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171) ~[tomcat-embed-core-10.1.16.jar!/:na]
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1332) ~[tomcat-embed-core-10.1.16.jar!/:na]
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1322) ~[tomcat-embed-core-10.1.16.jar!/:na]
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317) ~[na:na]
        at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) ~[tomcat-embed-core-10.1.16.jar!/:na]
        at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145) ~[na:na]
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:866) ~[tomcat-embed-core-10.1.16.jar!/:na]
        at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:845) ~[tomcat-embed-core-10.1.16.jar!/:na]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171) ~[tomcat-embed-core-10.1.16.jar!/:na]
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1332) ~[tomcat-embed-core-10.1.16.jar!/:na]
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1322) ~[tomcat-embed-core-10.1.16.jar!/:na]
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317) ~[na:na]
        at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) ~[tomcat-embed-core-10.1.16.jar!/:na]
        at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145) ~[na:na]
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:866) ~[tomcat-embed-core-10.1.16.jar!/:na]
        at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:240) ~[tomcat-embed-core-10.1.16.jar!/:na]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171) ~[tomcat-embed-core-10.1.16.jar!/:na]
        at org.apache.catalina.core.StandardService.startInternal(StandardService.java:433) ~[tomcat-embed-core-10.1.16.jar!/:na]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171) ~[tomcat-embed-core-10.1.16.jar!/:na]
        at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:917) ~[tomcat-embed-core-10.1.16.jar!/:na]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171) ~[tomcat-embed-core-10.1.16.jar!/:na]
        at org.apache.catalina.startup.Tomcat.start(Tomcat.java:488) ~[tomcat-embed-core-10.1.16.jar!/:na]
        at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:123) ~[spring-boot-3.2.0.jar!/:3.2.0]
        at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.<init>(TomcatWebServer.java:104) ~[spring-boot-3.2.0.jar!/:3.2.0]
        at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:501) ~[spring-boot-3.2.0.jar!/:3.2.0]
        at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:218) ~[spring-boot-3.2.0.jar!/:3.2.0]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:188) ~[spring-boot-3.2.0.jar!/:3.2.0]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:162) ~[spring-boot-3.2.0.jar!/:3.2.0]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:610) ~[spring-context-6.1.1.jar!/:6.1.1]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.2.0.jar!/:3.2.0]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:753) ~[spring-boot-3.2.0.jar!/:3.2.0]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:455) ~[spring-boot-3.2.0.jar!/:3.2.0]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:323) ~[spring-boot-3.2.0.jar!/:3.2.0]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1342) ~[spring-boot-3.2.0.jar!/:3.2.0]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1331) ~[spring-boot-3.2.0.jar!/:3.2.0]
        at org.vaadin.example.Application.main(Application.java:23) ~[!/:1.0-SNAPSHOT]
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[na:na]
        at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[na:na]
        at org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:91) ~[spring-skeleton-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
        at org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:53) ~[spring-skeleton-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
        at org.springframework.boot.loader.launch.JarLauncher.main(JarLauncher.java:58) ~[spring-skeleton-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
Caused by: java.lang.IllegalStateException: Parent resource of [nested:/C:/folder%20with%20space/skeleton-starter-flow-spring-24/target/spring-skeleton-1.0-SNAPSHOT.jar/!BOOT-INF/classes/!/org/vaadin/example/Application.class] not found in the resources!
        at com.vaadin.flow.spring.VaadinServletContextInitializer$CustomResourceLoader.collectResources(VaadinServletContextInitializer.java:1012) ~[vaadin-spring-24.3.2.jar!/:na]
        at com.vaadin.flow.spring.VaadinServletContextInitializer$CustomResourceLoader.getResources(VaadinServletContextInitializer.java:953) ~[vaadin-spring-24.3.2.jar!/:na]
        at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.scanCandidateComponents(ClassPathScanningCandidateComponentProvider.java:443) ~[spring-context-6.1.1.jar!/:6.1.1]
        at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:337) ~[spring-context-6.1.1.jar!/:6.1.1]
        at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[na:na]
        at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1708) ~[na:na]
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[na:na]
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[na:na]
        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921) ~[na:na]
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]
        at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682) ~[na:na]
        at com.vaadin.flow.spring.VaadinServletContextInitializer$VaadinAppShellContextListener.failFastContextInitialized(VaadinServletContextInitializer.java:646) ~[vaadin-spring-24.3.2.jar!/:na]
        at com.vaadin.flow.spring.VaadinServletContextInitializer$FailFastServletContextListener.contextInitialized(VaadinServletContextInitializer.java:195) ~[vaadin-spring-24.3.2.jar!/:na]
        ... 46 common frames omitted

2024-01-12T09:22:43.613+02:00 ERROR 207100 --- [           main] o.apache.catalina.core.StandardContext   : One or more listeners failed to start. Full details will be found in the appropriate container log file
2024-01-12T09:22:43.614+02:00 ERROR 207100 --- [           main] o.apache.catalina.core.StandardContext   : Context [] startup failed due to previous errors
2024-01-12T09:22:43.641+02:00  INFO 207100 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2024-01-12T09:22:43.643+02:00  WARN 207100 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server
2024-01-12T09:22:43.651+02:00  INFO 207100 --- [           main] .s.b.a.l.ConditionEvaluationReportLogger :

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2024-01-12T09:22:43.671+02:00 ERROR 207100 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.context.ApplicationContextException: Unable to start web server
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:165) ~[spring-boot-3.2.0.jar!/:3.2.0]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:610) ~[spring-context-6.1.1.jar!/:6.1.1]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.2.0.jar!/:3.2.0]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:753) ~[spring-boot-3.2.0.jar!/:3.2.0]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:455) ~[spring-boot-3.2.0.jar!/:3.2.0]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:323) ~[spring-boot-3.2.0.jar!/:3.2.0]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1342) ~[spring-boot-3.2.0.jar!/:3.2.0]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1331) ~[spring-boot-3.2.0.jar!/:3.2.0]
        at org.vaadin.example.Application.main(Application.java:23) ~[!/:1.0-SNAPSHOT]
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[na:na]
        at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[na:na]
        at org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:91) ~[spring-skeleton-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
        at org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:53) ~[spring-skeleton-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
        at org.springframework.boot.loader.launch.JarLauncher.main(JarLauncher.java:58) ~[spring-skeleton-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
        at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:142) ~[spring-boot-3.2.0.jar!/:3.2.0]
        at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.<init>(TomcatWebServer.java:104) ~[spring-boot-3.2.0.jar!/:3.2.0]
        at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:501) ~[spring-boot-3.2.0.jar!/:3.2.0]
        at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:218) ~[spring-boot-3.2.0.jar!/:3.2.0]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:188) ~[spring-boot-3.2.0.jar!/:3.2.0]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:162) ~[spring-boot-3.2.0.jar!/:3.2.0]
        ... 13 common frames omitted
Caused by: java.lang.IllegalStateException: StandardEngine[Tomcat].StandardHost[localhost].TomcatEmbeddedContext[] failed to start
        at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.rethrowDeferredStartupExceptions(TomcatWebServer.java:187) ~[spring-boot-3.2.0.jar!/:3.2.0]
        at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:126) ~[spring-boot-3.2.0.jar!/:3.2.0]
        ... 18 common frames omitted

Expected behavior

Works

Minimal reproducible example

  1. Unzip https://github.com/vaadin/skeleton-starter-flow-spring to a folder with spaces (e.g., C:\folder with space\skeleton-starter-flow-spring-24)
  2. mvn clean package -Pproduction
  3. java -jar .\target\spring-skeleton-1.0-SNAPSHOT.jar

Versions

  • Vaadin / Flow version: 24.3.2
  • Java version: 21.0.1
  • OS version: Windows 11

tarekoraby avatar Jan 12 '24 07:01 tarekoraby

These two look similar and can be used for investigation as well: https://github.com/vaadin/hilla/issues/838 https://github.com/vaadin/flow/issues/8191

mshabarov avatar Jan 16 '24 11:01 mshabarov

https://github.com/vaadin/hilla/issues/838 might already have been fixed by #17088

mcollovati avatar Jan 29 '24 11:01 mcollovati

Could not replicate this with any combination of folders with space jdk17 nor jdk21 for the given version of 24.3.2 nor 24.3.9

caalador avatar Apr 08 '24 11:04 caalador