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

Embedded Jetty 11 failed to start on Framework 6.0.2 / Boot 3.0.0 because of Servlet API 6.0 is used #33373

Closed
vladimirfx opened this issue Nov 26, 2022 · 1 comment
Labels
status: duplicate A duplicate of another issue

Comments

@vladimirfx
Copy link
Contributor

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
[
@vladimirfx
Copy link
Contributor Author

Because resolution requires runtime deps blackmagic maybe it is better to wait for Jetty 12 support.

Sims dup of #33044

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 26, 2022
@vladimirfx vladimirfx closed this as not planned Won't fix, can't repro, duplicate, stale Nov 28, 2022
@bclozel bclozel added status: duplicate A duplicate of another issue and removed status: waiting-for-triage An issue we've not yet triaged labels Nov 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

3 participants