When using Jetty version 10.0.6 and Java 17 Spring Boot 2.5.5 can't start.
Modify the pom.xml as per Spring Boot documentation
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.5</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>17</java.version>
<repackage.classifier/>
<spring-native.version>0.10.3</spring-native.version>
<jetty.version>10.0.6</jetty.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.2.0</version>
</dependency>
<dependency>
<groupId>org.springframework.experimental</groupId>
<artifactId>spring-native</artifactId>
<version>${spring-native.version}</version>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-alpn-java-server</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<classifier>${repackage.classifier}</classifier>
<image>
<builder>paketobuildpacks/builder:tiny</builder>
<env>
<BP_NATIVE_IMAGE>true</BP_NATIVE_IMAGE>
</env>
</image>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.experimental</groupId>
<artifactId>spring-aot-maven-plugin</artifactId>
<version>${spring-native.version}</version>
<executions>
<execution>
<id>test-generate</id>
<goals>
<goal>test-generate</goal>
</goals>
</execution>
<execution>
<id>generate</id>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-releases</id>
<name>Spring Releases</name>
<url>https://repo.spring.io/release</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-releases</id>
<name>Spring Releases</name>
<url>https://repo.spring.io/release</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<profiles>
<profile>
<id>native</id>
<properties>
<repackage.classifier>exec</repackage.classifier>
<native-buildtools.version>0.9.3</native-buildtools.version>
</properties>
<dependencies>
<dependency>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>junit-platform-native</artifactId>
<version>${native-buildtools.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<version>${native-buildtools.version}</version>
<executions>
<execution>
<id>test-native</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
</execution>
<execution>
<id>build-native</id>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
The application startup stack is as follows:
021-09-26 13:39:20.021 INFO 11864 --- [ main] o.s.b.w.e.j.JettyServletWebServerFactory : Server initialized with port: 8080
2021-09-26 13:39:20.022 INFO 11864 --- [ main] org.eclipse.jetty.server.Server : jetty-10.0.6; built: 2021-06-29T15:28:56.259Z; git: 37e7731b4b142a882d73974ff3bec78d621bd674; jvm 16.0.2+7-67
2021-09-26 13:39:20.044 WARN 11864 --- [ main] org.eclipse.jetty.webapp.Configurations : Unable to get known Configuration
java.util.ServiceConfigurationError:
at org.eclipse.jetty.util.ServiceLoaderSpliterator$ServiceProvider.get(ServiceLoaderSpliterator.java:101) ~[jetty-util-10.0.6.jar:10.0.6]
at org.eclipse.jetty.webapp.Configurations.lambda$getKnown$0(Configurations.java:80) ~[jetty-webapp-10.0.6.jar:10.0.6]
at org.eclipse.jetty.util.ServiceLoaderSpliterator.tryAdvance(ServiceLoaderSpliterator.java:46) ~[jetty-util-10.0.6.jar:10.0.6]
at java.base/java.util.Spliterator.forEachRemaining(Spliterator.java:326) ~[na:na]
at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762) ~[na:na]
at org.eclipse.jetty.webapp.Configurations.getKnown(Configurations.java:76) ~[jetty-webapp-10.0.6.jar:10.0.6]
at org.eclipse.jetty.webapp.WebAppContext.preConfigure(WebAppContext.java:474) ~[jetty-webapp-10.0.6.jar:10.0.6]
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:531) ~[jetty-webapp-10.0.6.jar:10.0.6]
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93) ~[jetty-util-10.0.6.jar:10.0.6]
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:171) ~[jetty-util-10.0.6.jar:10.0.6]
at org.eclipse.jetty.server.Server.start(Server.java:469) ~[jetty-server-10.0.6.jar:10.0.6]
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114) ~[jetty-util-10.0.6.jar:10.0.6]
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:89) ~[jetty-server-10.0.6.jar:10.0.6]
at org.eclipse.jetty.server.Server.doStart(Server.java:414) ~[jetty-server-10.0.6.jar:10.0.6]
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93) ~[jetty-util-10.0.6.jar:10.0.6]
at org.springframework.boot.web.embedded.jetty.JettyWebServer.initialize(JettyWebServer.java:123) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.web.embedded.jetty.JettyWebServer.<init>(JettyWebServer.java:90) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory.getJettyWebServer(JettyServletWebServerFactory.java:429) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory.getWebServer(JettyServletWebServerFactory.java:170) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:182) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:160) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:577) ~[spring-context-5.3.10.jar:5.3.10]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:338) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1332) ~[spring-boot-2.5.5.jar:2.5.5]
at com.example.demo.DemoApplication.main(DemoApplication.java:11) ~[classes/:na]
Caused by: java.util.ServiceConfigurationError: org.eclipse.jetty.webapp.Configuration: org.eclipse.jetty.plus.webapp.EnvConfiguration Unable to get public no-arg constructor
at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:582) ~[na:na]
at java.base/java.util.ServiceLoader.getConstructor(ServiceLoader.java:673) ~[na:na]
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1232) ~[na:na]
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1264) ~[na:na]
at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1299) ~[na:na]
at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1383) ~[na:na]
at org.eclipse.jetty.util.ServiceLoaderSpliterator.tryAdvance(ServiceLoaderSpliterator.java:37) ~[jetty-util-10.0.6.jar:10.0.6]
... 26 common frames omitted
Caused by: java.lang.NoClassDefFoundError: org/eclipse/jetty/jndi/NamingContext$Listener
at java.base/java.lang.Class.getDeclaredConstructors0(Native Method) ~[na:na]
at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3305) ~[na:na]
at java.base/java.lang.Class.getConstructor0(Class.java:3510) ~[na:na]
at java.base/java.lang.Class.getConstructor(Class.java:2238) ~[na:na]
at java.base/java.util.ServiceLoader$1.run(ServiceLoader.java:660) ~[na:na]
at java.base/java.util.ServiceLoader$1.run(ServiceLoader.java:657) ~[na:na]
at java.base/java.security.AccessController.doPrivileged(AccessController.java:554) ~[na:na]
at java.base/java.util.ServiceLoader.getConstructor(ServiceLoader.java:668) ~[na:na]
... 31 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.jndi.NamingContext$Listener
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:636) ~[na:na]
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:182) ~[na:na]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:519) ~[na:na]
... 39 common frames omitted
2021-09-26 13:39:20.052 INFO 11864 --- [ main] o.e.j.s.h.ContextHandler.application : Initializing Spring embedded WebApplicationContext
2021-09-26 13:39:20.052 INFO 11864 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 673 ms
2021-09-26 13:39:20.067 WARN 11864 --- [ main] org.eclipse.jetty.webapp.WebAppContext : Failed startup of context o.s.b.w.e.j.JettyEmbeddedWebAppContext@e26af6{application,/,[file:///C:/Users/Leo/AppData/Local/Temp/jetty-docbase.8080.4332670258783208886/],UNAVAILABLE}
java.lang.NoClassDefFoundError: org/eclipse/jetty/websocket/servlet/WebSocketCreator
at org.eclipse.jetty.websocket.server.NativeWebSocketServletContainerInitializer.initialize(NativeWebSocketServletContainerInitializer.java:63) ~[websocket-server-9.4.43.v20210629.jar:9.4.43.v20210629]
at org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer.initialize(WebSocketServerContainerInitializer.java:196) ~[javax-websocket-server-impl-9.4.43.v20210629.jar:9.4.43.v20210629]
at org.springframework.boot.autoconfigure.websocket.servlet.JettyWebSocketServletWebServerCustomizer$1.configure(JettyWebSocketServletWebServerCustomizer.java:46) ~[spring-boot-autoconfigure-2.5.5.jar:2.5.5]
at org.eclipse.jetty.webapp.Configurations.configure(Configurations.java:508) ~[jetty-webapp-10.0.6.jar:10.0.6]
at org.eclipse.jetty.webapp.WebAppContext.configure(WebAppContext.java:514) ~[jetty-webapp-10.0.6.jar:10.0.6]
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1300) ~[jetty-webapp-10.0.6.jar:10.0.6]
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:889) ~[jetty-server-10.0.6.jar:10.0.6]
at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:306) ~[jetty-servlet-10.0.6.jar:10.0.6]
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:532) ~[jetty-webapp-10.0.6.jar:10.0.6]
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93) ~[jetty-util-10.0.6.jar:10.0.6]
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:171) ~[jetty-util-10.0.6.jar:10.0.6]
at org.eclipse.jetty.server.Server.start(Server.java:469) ~[jetty-server-10.0.6.jar:10.0.6]
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114) ~[jetty-util-10.0.6.jar:10.0.6]
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:89) ~[jetty-server-10.0.6.jar:10.0.6]
at org.eclipse.jetty.server.Server.doStart(Server.java:414) ~[jetty-server-10.0.6.jar:10.0.6]
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93) ~[jetty-util-10.0.6.jar:10.0.6]
at org.springframework.boot.web.embedded.jetty.JettyWebServer.initialize(JettyWebServer.java:123) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.web.embedded.jetty.JettyWebServer.<init>(JettyWebServer.java:90) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory.getJettyWebServer(JettyServletWebServerFactory.java:429) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory.getWebServer(JettyServletWebServerFactory.java:170) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:182) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:160) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:577) ~[spring-context-5.3.10.jar:5.3.10]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:338) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1332) ~[spring-boot-2.5.5.jar:2.5.5]
at com.example.demo.DemoApplication.main(DemoApplication.java:11) ~[classes/:na]
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.websocket.servlet.WebSocketCreator
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:636) ~[na:na]
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:182) ~[na:na]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:519) ~[na:na]
... 30 common frames omitted
2021-09-26 13:39:20.068 INFO 11864 --- [ main] org.eclipse.jetty.server.Server : Stopped Server@2630dbc4{STOPPING}[10.0.6,sto=0]
2021-09-26 13:39:20.069 INFO 11864 --- [ main] o.e.jetty.server.handler.ContextHandler : Stopped o.s.b.w.e.j.JettyEmbeddedWebAppContext@e26af6{application,/,[file:///C:/Users/Leo/AppData/Local/Temp/jetty-docbase.8080.4332670258783208886/],STOPPED}
2021-09-26 13:39:20.069 WARN 11864 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Jetty web server
2021-09-26 13:39:20.074 INFO 11864 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-09-26 13:39:20.086 ERROR 11864 --- [ main] 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 Jetty web server
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:163) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:577) ~[spring-context-5.3.10.jar:5.3.10]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:338) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1332) ~[spring-boot-2.5.5.jar:2.5.5]
at com.example.demo.DemoApplication.main(DemoApplication.java:11) ~[classes/:na]
Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Jetty web server
at org.springframework.boot.web.embedded.jetty.JettyWebServer.initialize(JettyWebServer.java:129) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.web.embedded.jetty.JettyWebServer.<init>(JettyWebServer.java:90) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory.getJettyWebServer(JettyServletWebServerFactory.java:429) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory.getWebServer(JettyServletWebServerFactory.java:170) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:182) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:160) ~[spring-boot-2.5.5.jar:2.5.5]
... 8 common frames omitted
Caused by: java.lang.NoClassDefFoundError: org/eclipse/jetty/websocket/servlet/WebSocketCreator
at org.eclipse.jetty.websocket.server.NativeWebSocketServletContainerInitializer.initialize(NativeWebSocketServletContainerInitializer.java:63) ~[websocket-server-9.4.43.v20210629.jar:9.4.43.v20210629]
at org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer.initialize(WebSocketServerContainerInitializer.java:196) ~[javax-websocket-server-impl-9.4.43.v20210629.jar:9.4.43.v20210629]
at org.springframework.boot.autoconfigure.websocket.servlet.JettyWebSocketServletWebServerCustomizer$1.configure(JettyWebSocketServletWebServerCustomizer.java:46) ~[spring-boot-autoconfigure-2.5.5.jar:2.5.5]
at org.eclipse.jetty.webapp.Configurations.configure(Configurations.java:508) ~[jetty-webapp-10.0.6.jar:10.0.6]
at org.eclipse.jetty.webapp.WebAppContext.configure(WebAppContext.java:514) ~[jetty-webapp-10.0.6.jar:10.0.6]
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1300) ~[jetty-webapp-10.0.6.jar:10.0.6]
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:889) ~[jetty-server-10.0.6.jar:10.0.6]
at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:306) ~[jetty-servlet-10.0.6.jar:10.0.6]
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:532) ~[jetty-webapp-10.0.6.jar:10.0.6]
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93) ~[jetty-util-10.0.6.jar:10.0.6]
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:171) ~[jetty-util-10.0.6.jar:10.0.6]
at org.eclipse.jetty.server.Server.start(Server.java:469) ~[jetty-server-10.0.6.jar:10.0.6]
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114) ~[jetty-util-10.0.6.jar:10.0.6]
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:89) ~[jetty-server-10.0.6.jar:10.0.6]
at org.eclipse.jetty.server.Server.doStart(Server.java:414) ~[jetty-server-10.0.6.jar:10.0.6]
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93) ~[jetty-util-10.0.6.jar:10.0.6]
at org.springframework.boot.web.embedded.jetty.JettyWebServer.initialize(JettyWebServer.java:123) ~[spring-boot-2.5.5.jar:2.5.5]
... 13 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.websocket.servlet.WebSocketCreator
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:636) ~[na:na]
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:182) ~[na:na]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:519) ~[na:na]
... 30 common frames omitted
Comment From: leozhang123
If the websocket automatic configuration is excluded, the application can be started. However, exceptions will still be thrown
@SpringBootApplication(exclude = WebSocketServletAutoConfiguration.class)
exceptions :
2021-09-26 14:54:56.021 INFO 7272 --- [ main] org.eclipse.jetty.server.Server : jetty-10.0.6; built: 2021-06-29T15:28:56.259Z; git: 37e7731b4b142a882d73974ff3bec78d621bd674; jvm 16.0.2+7-67
2021-09-26 14:54:56.043 WARN 7272 --- [ main] org.eclipse.jetty.webapp.Configurations : Unable to get known Configuration
java.util.ServiceConfigurationError:
at org.eclipse.jetty.util.ServiceLoaderSpliterator$ServiceProvider.get(ServiceLoaderSpliterator.java:101) ~[jetty-util-10.0.6.jar:10.0.6]
at org.eclipse.jetty.webapp.Configurations.lambda$getKnown$0(Configurations.java:80) ~[jetty-webapp-10.0.6.jar:10.0.6]
at org.eclipse.jetty.util.ServiceLoaderSpliterator.tryAdvance(ServiceLoaderSpliterator.java:46) ~[jetty-util-10.0.6.jar:10.0.6]
at java.base/java.util.Spliterator.forEachRemaining(Spliterator.java:326) ~[na:na]
at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762) ~[na:na]
at org.eclipse.jetty.webapp.Configurations.getKnown(Configurations.java:76) ~[jetty-webapp-10.0.6.jar:10.0.6]
at org.eclipse.jetty.webapp.WebAppContext.preConfigure(WebAppContext.java:474) ~[jetty-webapp-10.0.6.jar:10.0.6]
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:531) ~[jetty-webapp-10.0.6.jar:10.0.6]
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93) ~[jetty-util-10.0.6.jar:10.0.6]
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:171) ~[jetty-util-10.0.6.jar:10.0.6]
at org.eclipse.jetty.server.Server.start(Server.java:469) ~[jetty-server-10.0.6.jar:10.0.6]
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114) ~[jetty-util-10.0.6.jar:10.0.6]
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:89) ~[jetty-server-10.0.6.jar:10.0.6]
at org.eclipse.jetty.server.Server.doStart(Server.java:414) ~[jetty-server-10.0.6.jar:10.0.6]
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93) ~[jetty-util-10.0.6.jar:10.0.6]
at org.springframework.boot.web.embedded.jetty.JettyWebServer.initialize(JettyWebServer.java:123) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.web.embedded.jetty.JettyWebServer.<init>(JettyWebServer.java:90) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory.getJettyWebServer(JettyServletWebServerFactory.java:429) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory.getWebServer(JettyServletWebServerFactory.java:170) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:182) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:160) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:577) ~[spring-context-5.3.10.jar:5.3.10]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:338) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1332) ~[spring-boot-2.5.5.jar:2.5.5]
at com.example.demo.DemoApplication.main(DemoApplication.java:11) ~[classes/:na]
Caused by: java.util.ServiceConfigurationError: org.eclipse.jetty.webapp.Configuration: org.eclipse.jetty.plus.webapp.EnvConfiguration Unable to get public no-arg constructor
at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:582) ~[na:na]
at java.base/java.util.ServiceLoader.getConstructor(ServiceLoader.java:673) ~[na:na]
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1232) ~[na:na]
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1264) ~[na:na]
at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1299) ~[na:na]
at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1383) ~[na:na]
at org.eclipse.jetty.util.ServiceLoaderSpliterator.tryAdvance(ServiceLoaderSpliterator.java:37) ~[jetty-util-10.0.6.jar:10.0.6]
... 26 common frames omitted
Caused by: java.lang.NoClassDefFoundError: org/eclipse/jetty/jndi/NamingContext$Listener
at java.base/java.lang.Class.getDeclaredConstructors0(Native Method) ~[na:na]
at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3305) ~[na:na]
at java.base/java.lang.Class.getConstructor0(Class.java:3510) ~[na:na]
at java.base/java.lang.Class.getConstructor(Class.java:2238) ~[na:na]
at java.base/java.util.ServiceLoader$1.run(ServiceLoader.java:660) ~[na:na]
at java.base/java.util.ServiceLoader$1.run(ServiceLoader.java:657) ~[na:na]
at java.base/java.security.AccessController.doPrivileged(AccessController.java:554) ~[na:na]
at java.base/java.util.ServiceLoader.getConstructor(ServiceLoader.java:668) ~[na:na]
... 31 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.jndi.NamingContext$Listener
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:636) ~[na:na]
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:182) ~[na:na]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:519) ~[na:na]
... 39 common frames omitted
2021-09-26 14:54:56.051 INFO 7272 --- [ main] o.e.j.s.h.ContextHandler.application : Initializing Spring embedded WebApplicationContext
2021-09-26 14:54:56.051 INFO 7272 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 674 ms
2021-09-26 14:54:56.066 INFO 7272 --- [ main] o.e.j.s.session.DefaultSessionIdManager : Session workerName=node0
2021-09-26 14:54:56.071 INFO 7272 --- [ main] o.e.jetty.server.handler.ContextHandler : Started o.s.b.w.e.j.JettyEmbeddedWebAppContext@cda6019{application,/,[file:///C:/Users/Leo/AppData/Local/Temp/jetty-docbase.8080.16640031447911122972/],AVAILABLE}
2021-09-26 14:54:56.072 INFO 7272 --- [ main] org.eclipse.jetty.server.Server : Started Server@784abd3e{STARTING}[10.0.6,sto=0] @1456ms
2021-09-26 14:54:56.414 INFO 7272 --- [ main] o.e.j.s.h.ContextHandler.application : Initializing Spring DispatcherServlet 'dispatcherServlet'
2021-09-26 14:54:56.414 INFO 7272 --- [ main] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2021-09-26 14:54:56.415 INFO 7272 --- [ main] o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms
2021-09-26 14:54:56.445 INFO 7272 --- [ main] o.e.jetty.server.AbstractConnector : Started ServerConnector@761e788f{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
2021-09-26 14:54:56.446 INFO 7272 --- [ main] o.s.b.web.embedded.jetty.JettyWebServer : Jetty started on port(s) 8080 (http/1.1) with context path '/'
2021-09-26 14:54:56.452 INFO 7272 --- [ main] com.example.demo.DemoApplication : Started DemoApplication in 1.35 seconds (JVM running for 1.836)
Comment From: wilkinsona
You are missing the exclusions described in the Spring Boot 2.5 release notes. Can you please try with those in place. If that doesn't help and you would like us to spend some more time investigating, please spend some time providing a complete yet minimal sample (a pom.xml alone isn't sufficient) that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue.
Comment From: leozhang123
You are missing the exclusions described in the Spring Boot 2.5 release notes. Can you please try with those in place. If that doesn't help and you would like us to spend some more time investigating, please spend some time providing a complete yet minimal sample (a pom.xml alone isn't sufficient) that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue.
The problem is solved,Thank you!
Comment From: snicoll
Thanks for letting us know.