spring-boot-starter-web with spring-boot-starter-jetty is used. Another environment does not matter.
Reproducer: boot3-jetty11-error.zip
Workaround (Gradle):
runtimeOnly("org.eclipse.jetty.toolchain:jetty-jakarta-servlet-api:5.0.2")
Error log:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v3.0.0)
2022-11-26T13:35:34.558Z INFO 1 --- [ main] r.f.m.b.ApplicationKt : Starting ApplicationKt using Java 17.0.5 with PID 1 (/app/classes started by nobody in /)
2022-11-26T13:35:34.559Z INFO 1 --- [ main] r.f.m.b.ApplicationKt : No active profile set, falling back to 1 default profile: "default"
2022-11-26T13:35:36.250Z INFO 1 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2022-11-26T13:35:36.318Z INFO 1 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 58 ms. Found 0 JPA repository interfaces.
2022-11-26T13:35:37.085Z WARN 1 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server
2022-11-26T13:35:37.130Z INFO 1 --- [ main] .s.b.a.l.ConditionEvaluationReportLogger :
Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2022-11-26T13:35:37.209Z ERROR 1 --- [ main] o.s.b.SpringApplication : Application run failed
org.springframework.context.ApplicationContextException: Unable to start web server
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:164) ~[spring-boot-3.0.0.jar:3.0.0]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:578) ~[spring-context-6.0.2.jar:6.0.2]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.0.0.jar:3.0.0]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730) ~[spring-boot-3.0.0.jar:3.0.0]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:432) ~[spring-boot-3.0.0.jar:3.0.0]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) ~[spring-boot-3.0.0.jar:3.0.0]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302) ~[spring-boot-3.0.0.jar:3.0.0]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1291) ~[spring-boot-3.0.0.jar:3.0.0]
at ru.fcb.mobilefieldcollection.backend.ApplicationKt.main(Application.kt:57) ~[classes/:?]
Caused by: java.lang.NoClassDefFoundError: jakarta/servlet/http/HttpSessionContext
at org.eclipse.jetty.servlet.ServletContextHandler.newSessionHandler(ServletContextHandler.java:339) ~[jetty-servlet-11.0.12.jar:11.0.12]
at org.eclipse.jetty.servlet.ServletContextHandler.getSessionHandler(ServletContextHandler.java:432) ~[jetty-servlet-11.0.12.jar:11.0.12]
at org.eclipse.jetty.servlet.ServletContextHandler.relinkHandlers(ServletContextHandler.java:257) ~[jetty-servlet-11.0.12.jar:11.0.12]
at org.eclipse.jetty.servlet.ServletContextHandler.<init>(ServletContextHandler.java:180) ~[jetty-servlet-11.0.12.jar:11.0.12]
at org.eclipse.jetty.webapp.WebAppContext.<init>(WebAppContext.java:301) ~[jetty-webapp-11.0.12.jar:11.0.12]
at org.eclipse.jetty.webapp.WebAppContext.<init>(WebAppContext.java:228) ~[jetty-webapp-11.0.12.jar:11.0.12]
at org.springframework.boot.web.embedded.jetty.JettyEmbeddedWebAppContext.<init>(JettyEmbeddedWebAppContext.java:28) ~[spring-boot-3.0.0.jar:3.0.0]
at org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory.getWebServer(JettyServletWebServerFactory.java:158) ~[spring-boot-3.0.0.jar:3.0.0]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:183) ~[spring-boot-3.0.0.jar:3.0.0]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:161) ~[spring-boot-3.0.0.jar:3.0.0]
... 8 more
Caused by: java.lang.ClassNotFoundException: jakarta.servlet.http.HttpSessionContext
at jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) ~[?:?]
at jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) ~[?:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?]
at org.eclipse.jetty.servlet.ServletContextHandler.newSessionHandler(ServletContextHandler.java:339) ~[jetty-servlet-11.0.12.jar:11.0.12]
at org.eclipse.jetty.servlet.ServletContextHandler.getSessionHandler(ServletContextHandler.java:432) ~[jetty-servlet-11.0.12.jar:11.0.12]
at org.eclipse.jetty.servlet.ServletContextHandler.relinkHandlers(ServletContextHandler.java:257) ~[jetty-servlet-11.0.12.jar:11.0.12]
at org.eclipse.jetty.servlet.ServletContextHandler.<init>(ServletContextHandler.java:180) ~[jetty-servlet-11.0.12.jar:11.0.12]
at org.eclipse.jetty.webapp.WebAppContext.<init>(WebAppContext.java:301) ~[jetty-webapp-11.0.12.jar:11.0.12]
at org.eclipse.jetty.webapp.WebAppContext.<init>(WebAppContext.java:228) ~[jetty-webapp-11.0.12.jar:11.0.12]
at org.springframework.boot.web.embedded.jetty.JettyEmbeddedWebAppContext.<init>(JettyEmbeddedWebAppContext.java:28) ~[spring-boot-3.0.0.jar:3.0.0]
at org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory.getWebServer(JettyServletWebServerFactory.java:158) ~[spring-boot-3.0.0.jar:3.0.0]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:183) ~[spring-boot-3.0.0.jar:3.0.0]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:161) ~[spring-boot-3.0.0.jar:3.0.0]
... 8 more
[
Comment From: vladimirfx
Because resolution requires runtime deps blackmagic maybe it is better to wait for Jetty 12 support.
Sims dup of https://github.com/spring-projects/spring-boot/issues/33044