Skip to content
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

Spring Boot Remote not working since v2.7.12 #39733

Open
manusa opened this issue Feb 22, 2024 · 4 comments
Open

Spring Boot Remote not working since v2.7.12 #39733

manusa opened this issue Feb 22, 2024 · 4 comments
Labels
status: feedback-provided Feedback has been provided status: waiting-for-triage An issue we've not yet triaged

Comments

@manusa
Copy link

manusa commented Feb 22, 2024

Description

Starting on v2.7.12 (last working version was v2.7.11) and up to any 3.x.x version Spring Boot Remote has stopped working.

Whenever a remote session is started and changes are detected, Spring Remote tries to restart the application but the application can't start.

Spring Remote output

Spring-Remote: 2024-02-22 12:45:34.557  INFO 2076049 --- [           main] o.s.b.d.a.OptionalLiveReloadServer       : LiveReload server is running on port 35729
Spring-Remote: 2024-02-22 12:45:34.568  INFO 2076049 --- [           main] o.s.b.devtools.RemoteSpringApplication   : Started RemoteSpringApplication in 0.437 seconds (JVM running for 0.706)
Spring-Remote: 2024-02-22 12:45:54.971  INFO 2076049 --- [   File Watcher] o.s.b.d.r.c.ClassPathChangeUploader      : Uploading 2 class path changes (0 additions, 0 deletions, 2 modifications)
Spring-Remote: 2024-02-22 12:46:01.009  INFO 2076049 --- [pool-1-thread-1] o.s.b.d.r.c.DelayedLiveReloadTrigger     : Remote server has changed, triggering LiveReload

Application output

Click to expand detailed output
2024-02-22 11:45:55.472  INFO 1 --- [  restartedMain] o.e.j.m.sample.spring.boot.Application   : Starting Application v1.16.0 using Java 21.0.1 on spring-boot-watch-5c76d5ff4-dt2gl with PID 1 (/deployments/BOOT-INF/classes 
2024-02-22 11:45:55.483  INFO 1 --- [  restartedMain] o.e.j.m.sample.spring.boot.Application   : No active profile set, falling back to 1 default profile: "default"
2024-02-22 11:45:55.546  INFO 1 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2024-02-22 11:45:55.547  INFO 1 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2024-02-22 11:45:56.404  INFO 1 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2024-02-22 11:45:56.419  INFO 1 --- [  restartedMain] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2024-02-22 11:45:56.422  INFO 1 --- [  restartedMain] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.75]
2024-02-22 11:45:56.456 ERROR 1 --- [  restartedMain] org.apache.catalina.core.ContainerBase   : A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to initialize component [org.apache.catalina.webresources.StandardRoot@1ac5674e]
	at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[na:na]
	at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191) ~[na:na]
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:878) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:795) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1332) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1322) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	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-9.0.75.jar:9.0.75]
	at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145) ~[na:na]
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:871) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:249) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.core.StandardService.startInternal(StandardService.java:428) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:914) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.startup.Tomcat.start(Tomcat.java:486) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:123) ~[spring-boot-2.7.12.jar:2.7.12]
	at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.<init>(TomcatWebServer.java:104) ~[spring-boot-2.7.12.jar:2.7.12]
	at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:481) ~[spring-boot-2.7.12.jar:2.7.12]
	at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:211) ~[spring-boot-2.7.12.jar:2.7.12]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:184) ~[spring-boot-2.7.12.jar:2.7.12]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:162) ~[spring-boot-2.7.12.jar:2.7.12]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:577) ~[spring-context-5.3.27.jar:5.3.27]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) ~[spring-boot-2.7.12.jar:2.7.12]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:731) ~[spring-boot-2.7.12.jar:2.7.12]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) ~[spring-boot-2.7.12.jar:2.7.12]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) ~[spring-boot-2.7.12.jar:2.7.12]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1303) ~[spring-boot-2.7.12.jar:2.7.12]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1292) ~[spring-boot-2.7.12.jar:2.7.12]
	at org.eclipse.jkube.maven.sample.spring.boot.Application.main(Application.java:23) ~[classes/:1.16.0]
	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.MainMethodRunner.run(MainMethodRunner.java:49) ~[deployments/:na]
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:108) ~[deployments/:na]
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) ~[deployments/:na]
	at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:65) ~[deployments/:na]
	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.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-2.7.12.jar:2.7.12]
Caused by: org.apache.catalina.LifecycleException: Failed to initialize component [org.apache.catalina.webresources.StandardRoot@1ac5674e]
	at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:139) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:173) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4607) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4740) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1332) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1322) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	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-9.0.75.jar:9.0.75]
	at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145) ~[na:na]
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:871) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	... 38 common frames omitted
Caused by: java.lang.Error: factory already defined
	at java.base/java.net.URL.setURLStreamHandlerFactory(URL.java:1392) ~[na:na]
	at org.apache.catalina.webresources.TomcatURLStreamHandlerFactory.<init>(TomcatURLStreamHandlerFactory.java:121) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.webresources.TomcatURLStreamHandlerFactory.getInstanceInternal(TomcatURLStreamHandlerFactory.java:52) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.webresources.TomcatURLStreamHandlerFactory.register(TomcatURLStreamHandlerFactory.java:73) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.webresources.StandardRoot.registerURLStreamHandlerFactory(StandardRoot.java:699) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.webresources.StandardRoot.initInternal(StandardRoot.java:686) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	... 48 common frames omitted
2024-02-22 11:45:56.464 ERROR 1 --- [  restartedMain] org.apache.catalina.core.ContainerBase   : A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: A child container failed during start
	at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[na:na]
	at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191) ~[na:na]
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:878) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:249) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.core.StandardService.startInternal(StandardService.java:428) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:914) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.startup.Tomcat.start(Tomcat.java:486) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:123) ~[spring-boot-2.7.12.jar:2.7.12]
	at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.<init>(TomcatWebServer.java:104) ~[spring-boot-2.7.12.jar:2.7.12]
	at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:481) ~[spring-boot-2.7.12.jar:2.7.12]
	at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:211) ~[spring-boot-2.7.12.jar:2.7.12]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:184) ~[spring-boot-2.7.12.jar:2.7.12]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:162) ~[spring-boot-2.7.12.jar:2.7.12]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:577) ~[spring-context-5.3.27.jar:5.3.27]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) ~[spring-boot-2.7.12.jar:2.7.12]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:731) ~[spring-boot-2.7.12.jar:2.7.12]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) ~[spring-boot-2.7.12.jar:2.7.12]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) ~[spring-boot-2.7.12.jar:2.7.12]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1303) ~[spring-boot-2.7.12.jar:2.7.12]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1292) ~[spring-boot-2.7.12.jar:2.7.12]
	at org.eclipse.jkube.maven.sample.spring.boot.Application.main(Application.java:23) ~[classes/:1.16.0]
	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.MainMethodRunner.run(MainMethodRunner.java:49) ~[deployments/:na]
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:108) ~[deployments/:na]
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) ~[deployments/:na]
	at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:65) ~[deployments/:na]
	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.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-2.7.12.jar:2.7.12]
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:890) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:795) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1332) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1322) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	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-9.0.75.jar:9.0.75]
	at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145) ~[na:na]
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:871) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	... 30 common frames omitted
Caused by: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to initialize component [org.apache.catalina.webresources.StandardRoot@1ac5674e]
	at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[na:na]
	at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191) ~[na:na]
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:878) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	... 38 common frames omitted
Caused by: org.apache.catalina.LifecycleException: Failed to initialize component [org.apache.catalina.webresources.StandardRoot@1ac5674e]
	at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:139) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:173) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4607) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4740) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1332) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1322) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	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-9.0.75.jar:9.0.75]
	at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145) ~[na:na]
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:871) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	... 38 common frames omitted
Caused by: java.lang.Error: factory already defined
	at java.base/java.net.URL.setURLStreamHandlerFactory(URL.java:1392) ~[na:na]
	at org.apache.catalina.webresources.TomcatURLStreamHandlerFactory.<init>(TomcatURLStreamHandlerFactory.java:121) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.webresources.TomcatURLStreamHandlerFactory.getInstanceInternal(TomcatURLStreamHandlerFactory.java:52) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.webresources.TomcatURLStreamHandlerFactory.register(TomcatURLStreamHandlerFactory.java:73) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.webresources.StandardRoot.registerURLStreamHandlerFactory(StandardRoot.java:699) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.webresources.StandardRoot.initInternal(StandardRoot.java:686) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	... 48 common frames omitted
2024-02-22 11:45:56.465  INFO 1 --- [  restartedMain] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2024-02-22 11:45:56.479  WARN 1 --- [  restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationConte
2024-02-22 11:45:56.491  INFO 1 --- [  restartedMain] ConditionEvaluationReportLoggingListener : 
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2024-02-22 11:45:56.509 ERROR 1 --- [  restartedMain] o.s.boot.SpringApplication               : Application run failed
org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:165) ~[spring-boot-2.7.12.jar:2.7.12]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:577) ~[spring-context-5.3.27.jar:5.3.27]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) ~[spring-boot-2.7.12.jar:2.7.12]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:731) ~[spring-boot-2.7.12.jar:2.7.12]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) ~[spring-boot-2.7.12.jar:2.7.12]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) ~[spring-boot-2.7.12.jar:2.7.12]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1303) ~[spring-boot-2.7.12.jar:2.7.12]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1292) ~[spring-boot-2.7.12.jar:2.7.12]
	at org.eclipse.jkube.maven.sample.spring.boot.Application.main(Application.java:23) ~[classes/:1.16.0]
	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.MainMethodRunner.run(MainMethodRunner.java:49) ~[deployments/:na]
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:108) ~[deployments/:na]
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) ~[deployments/:na]
	at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:65) ~[deployments/:na]
	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.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-2.7.12.jar:2.7.12]
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-2.7.12.jar:2.7.12]
	at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.<init>(TomcatWebServer.java:104) ~[spring-boot-2.7.12.jar:2.7.12]
	at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:481) ~[spring-boot-2.7.12.jar:2.7.12]
	at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:211) ~[spring-boot-2.7.12.jar:2.7.12]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:184) ~[spring-boot-2.7.12.jar:2.7.12]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:162) ~[spring-boot-2.7.12.jar:2.7.12]
	... 17 common frames omitted
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:890) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:249) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.core.StandardService.startInternal(StandardService.java:428) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:914) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.startup.Tomcat.start(Tomcat.java:486) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:123) ~[spring-boot-2.7.12.jar:2.7.12]
	... 22 common frames omitted
Caused by: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: A child container failed during start
	at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[na:na]
	at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191) ~[na:na]
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:878) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	... 30 common frames omitted
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:890) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:795) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1332) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1322) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	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-9.0.75.jar:9.0.75]
	at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145) ~[na:na]
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:871) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	... 30 common frames omitted
Caused by: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to initialize component [org.apache.catalina.webresources.StandardRoot@1ac5674e]
	at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[na:na]
	at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191) ~[na:na]
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:878) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	... 38 common frames omitted
Caused by: org.apache.catalina.LifecycleException: Failed to initialize component [org.apache.catalina.webresources.StandardRoot@1ac5674e]
	at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:139) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:173) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4607) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4740) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1332) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1322) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	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-9.0.75.jar:9.0.75]
	at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145) ~[na:na]
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:871) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	... 38 common frames omitted
Caused by: java.lang.Error: factory already defined
	at java.base/java.net.URL.setURLStreamHandlerFactory(URL.java:1392) ~[na:na]
	at org.apache.catalina.webresources.TomcatURLStreamHandlerFactory.<init>(TomcatURLStreamHandlerFactory.java:121) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.webresources.TomcatURLStreamHandlerFactory.getInstanceInternal(TomcatURLStreamHandlerFactory.java:52) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.webresources.TomcatURLStreamHandlerFactory.register(TomcatURLStreamHandlerFactory.java:73) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.webresources.StandardRoot.registerURLStreamHandlerFactory(StandardRoot.java:699) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.webresources.StandardRoot.initInternal(StandardRoot.java:686) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	... 48 common frames omitted

Relevant pieces:

Caused by: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to initialize component [org.apache.catalina.webresources.StandardRoot@1ac5674e]
Caused by: org.apache.catalina.LifecycleException: Failed to initialize component [org.apache.catalina.webresources.StandardRoot@1ac5674e]
Caused by: java.lang.Error: factory already defined
	at java.base/java.net.URL.setURLStreamHandlerFactory(URL.java:1392) ~[na:na]
	at org.apache.catalina.webresources.TomcatURLStreamHandlerFactory.<init>(TomcatURLStreamHandlerFactory.java:121) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.webresources.TomcatURLStreamHandlerFactory.getInstanceInternal(TomcatURLStreamHandlerFactory.java:52) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.webresources.TomcatURLStreamHandlerFactory.register(TomcatURLStreamHandlerFactory.java:73) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.webresources.StandardRoot.registerURLStreamHandlerFactory(StandardRoot.java:699) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.webresources.StandardRoot.initInternal(StandardRoot.java:686) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136) ~[tomcat-embed-core-9.0.75.jar:9.0.75]
	... 48 common frames omitted

Expected application output

Click to expand
2024-02-22 11:54:08.604  INFO 1 --- [  restartedMain] o.e.j.m.sample.spring.boot.Application   : Starting Application v1.16.0 using Java 21.0.1 on spring-boot-watch-5c76d5ff4-8pxz2 with PID 1 (/deployments/BOOT-INF/classes started by jboss in /deployments)
2024-02-22 11:54:08.606  INFO 1 --- [  restartedMain] o.e.j.m.sample.spring.boot.Application   : No active profile set, falling back to 1 default profile: "default"
2024-02-22 11:54:08.931  INFO 1 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2024-02-22 11:54:08.933  INFO 1 --- [  restartedMain] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2024-02-22 11:54:08.934  INFO 1 --- [  restartedMain] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.74]
2024-02-22 11:54:08.947  INFO 1 --- [  restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2024-02-22 11:54:08.948  INFO 1 --- [  restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 338 ms
2024-02-22 11:54:08.985  WARN 1 --- [  restartedMain] .s.b.d.a.RemoteDevToolsAutoConfiguration : Listening for remote restart updates on /.~~spring-boot!~/restart
2024-02-22 11:54:09.094  INFO 1 --- [  restartedMain] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 1 endpoint(s) beneath base path '/actuator'
2024-02-22 11:54:09.151  INFO 1 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2024-02-22 11:54:09.158  INFO 1 --- [  restartedMain] o.e.j.m.sample.spring.boot.Application   : Started Application in 0.582 seconds (JVM running for 30.111)
2024-02-22 11:54:09.539  INFO 1 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2024-02-22 11:54:09.539  INFO 1 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'

According to other issues with reference to the "factory already defined" error, it seems that Tomcat uses a static to ensure that setURLStreamHandlerFactory is only called once. However, it does seem that this shouldn't be applicable, or should be specifically tackled, for the remote dev tools.

As a reproducer project you can use JKube's Spring Boot Watch quickstart and a local Kubernetes cluster such as Minikube. Changing the Spring Boot Starter Parent version to anything beyond 2.7.12 should reproduce the problem.

Relates to:

@wilkinsona
Copy link
Member

Thanks for the report. We have integration tests for restarts with both a local application and a remote application. The app that's used for tests uses Tomcat and all of the tests are passing. In short, we're not aware of any general problems with the remote restart support so there must be something specific to your usage of it that is causing it to break.

As a reproducer project you can use JKube's Spring Boot Watch quickstart and a local Kubernetes cluster such as Minikube.

Unfortunately, we don't have time to use such a complex reproducer as there are too many moving parts. Any one of them could be causing the problem, not just Spring Boot. If you would like us to spend some more time investigating, please provide a reproducer that contains the bare minimum that's needed to reproduce the problem. The process of producing this reproducer may identify an external cause which can then be addressed by the relevant maintainers. If it identifies Spring Boot as the cause we can then take another look and see why our existing tests didn't catch the problem.

@wilkinsona wilkinsona added the status: waiting-for-feedback We need additional information before we can continue label Feb 29, 2024
@manusa
Copy link
Author

manusa commented Feb 29, 2024

Hi @wilkinsona,

I managed to create a fairly simple end to end (e2e) test project that consistently reproduces the issue.
You can check the source code here: https://github.com/marcnuri-work/spring-projects-spring-boot-issues-39733/tree/290fe9c5e81c994154b0bf949b10dfef3145ba97.

You should be able to clone the project and run ./mvnw verify to run the tests.
I also defined a GitHub CI workflow which also reproduces the issue.

If you carefully review the CI logs, you'll notice that with version 2.7.11, the test does pass:
https://github.com/marcnuri-work/spring-projects-spring-boot-issues-39733/actions/runs/8100572266/job/22138883889#step:4:1501

However, for the 2.7.12 version the test fails (I assume it will be the same for any 3.x.x version too):
https://github.com/marcnuri-work/spring-projects-spring-boot-issues-39733/actions/runs/8100572266/job/22138883889#step:4:1502

I configured the test to print out the log of the remote application, we can see here the stacktrace I mentioned in the issue description:

Caused by: java.lang.Error: factory already defined
	at java.base/java.net.URL.setURLStreamHandlerFactory(URL.java:1392) ~[na:na]

Regarding the integration test you linked, I'm not sure if it applies to the current scenario (Remote Update). I do see there's a RemoteApplicationLauncher, but this one doesn't contain a test scenario for the update feature either.


P.S. I saw there was a link to the integration tests after bootstrapping my own project and working on the complete implementation 🤦. I would have worked on the original repo otherwise, sorry.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Feb 29, 2024
@wilkinsona
Copy link
Member

Regarding the integration test you linked, I'm not sure if it applies to the current scenario (Remote Update). I do see there's a RemoteApplicationLauncher, but this one doesn't contain a test scenario for the update feature either.

I am pretty sure that it does. Every test in that class is making an update to the application. The tests are run in three different ways:

  • With a local application
  • With a remote application
  • With a remote application running as a jar file

However, for the 2.7.12 version the test fails (I assume it will be the same for any 3.x.x version too):

Spring Boot 2.7.x is out of OSS support. Do you know that it fails with 3.x.x or is this just an assumption?

@manusa
Copy link
Author

manusa commented Mar 1, 2024

I am pretty sure that it does.

As I said, I just gave an overall look, I surely missed it. I assumed it was just testing with local application. Since it's an integration test (no apparent separate process invocations) it's hard (for me) to understand what's really going on.

Do you know that it fails with 3.x.x or is this just an assumption?

Not an assumption, it has the same failure https://github.com/marcnuri-work/spring-projects-spring-boot-issues-39733/actions/runs/8115267126/job/22182771368#step:4:1942 (I just added 3.2.0 to the test suite).

P.S. BTW learning that end of commercial support for 2.x (i.e. Java 8) is mid 2025 just killed me, for some reason I thought it was mid-2024 when it would be over 😭,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: feedback-provided Feedback has been provided status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

No branches or pull requests

3 participants