Spring boot JSP error: NoClassDefFoundError

前端 未结 3 1598
迷失自我
迷失自我 2021-02-08 13:30

Everytime I try to run spring boot app configured with JSP I get this error:

java.lang.NoClassDefFoundError: javax/servlet/ServletContext
    at java.lang.Class.         


        
3条回答
  •  天命终不由人
    2021-02-08 14:02

    Another workaround was suggested on the bug report.

    You can use the provided as suggested in the Spring documentation, and then go into your Project Settings in IntelliJ. For the module in question, in the Dependencies tab, you should see that the dependencies related to spring-boot-starter-tomcat are all listed as "Provided". Changing them to "Compile" should force IntelliJ to add them to the classpath.

    It has the advantage of both not requiring any modifications to your pom.xml and allowing you to use the Spring Boot integration provided by IntelliJ.

提交回复
热议问题