java.lang.NoClassDefFoundError: javax/servlet/ServletContext
Had the same problem, fixed it by fixing pom.xml changed in pom.xml:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
changing it to:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>compile</scope>
</dependency>
this solved the problem :)
Had the same issue when using Community Edition that has no springboot template.
The issue can be solved in Edit Configurations... -> Modify options -> Check Java: Include dependencies with "Provided" scope
Had same problem. Seemed specific to trying to run a spring boot web app via IntelliJ 15.x spring boot
run configuration. Since I was using maven
I instead created a maven
run configuration specifying the command line action
as spring-boot:run
- this works both in run and debug modes. Screenshot attached.
OK here is what I had to do to solve this specific issue:
- IntelliJ needed to have a definition for Gradle Task called bootRun within the Debug/Run Configuration. This allows me to now run back-end code or debug back-end code updates in IntelliJ.
- Next I had to restructure my IntelliJ directories because IntelliJ 15 had installed both a parent and a child JRE folder which is incorrect so therefore IntelliJ displayed and exception stating that it could not find the a) java.exec nor the b) jvm.cfg files under it's JRE/Lib sub-directory.
Once I fixed these two issues both builds and debugging seemed to work for Java Spring back end. I followed up with IntelliJ about the quirky JRE installation.