Issue:
I understand that Spring Boot 3 is currently in high demand in the market, and many applications are eager to migrate to it, which is indeed a positive trend. However, it's crucial to be aware that there are some significant changes that may pose challenges. I recently encountered a similar issue when attempting to use Jetty instead of Tomcat.
Error:
java.lang.ClassNotFoundException: jakarta.servlet.http.HttpSessionContext with Spring Boot 3 and Jetty server
Solution:
Upon investigation, I found that Spring Boot 3 requires the inclusion of several additional libraries in the project's `pom.xml` file. These libraries are listed below:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>6.0.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>11.0.14</version>
</dependency>
Please let me know in the comments section if the above solution doesn't work for you and thanks for checking out my site
Yorumlar