启动spring-boot报错java.lang.NoClassDefFoundError: javax/servlet/ServletContext

时间:2023-01-19 22:08:29
idea启动spring-boot,报java.lang.NoClassDefFoundError: javax/servlet/ServletContext错误,解决方法:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>

scope注释掉即可;

建议勾上rebuild module on dependency change选项

在settings... -> compiler ->Rebuild module on dependency change