It might look like a duplicate of this question, but the solutions from it didn't work for me. I am getting an Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/boot/SpringApplication at com.example.demo.Application.main
error when I try to run the application using spring-boot. My pom.xml
:
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example.blog</groupId>
<artifactId>module-8-16-springboot-webflow-thymeleaf</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.1.RELEASE</version>
<relativePath />
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.webflow</groupId>
<artifactId>spring-webflow</artifactId>
<version>2.5.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.webflow</groupId>
<artifactId>org.springframework.js</artifactId>
<version>2.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</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-thymeleaf</artifactId>
</dependency>
<!-- And other dependencies -->
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
JDK 1.8 and JRE 8 are installed on the system and worked fine before. I deleted the C:\Users\{username}\.M2\repository\org\springframework\boot
directory on the system and forced Maven to reload the dependencies. Then I decompiled the file C:\Users\{username}\.M2\repository\org\springframework\boot\spring-boot\2.0.1.RELEASE\spring-boot-2.0.1.RELEASE.jar
and still found it in it has this SpringApplication
class that the JVM cannot find. I also explicitly added spring-boot-2.0.1.RELEASE.jar
to the project, but the error remained the same. There is only a suspicion that I am using Open JDK, and not Oracle, which did not install on the system, but simply downloaded the deployed files and placed them in the folder I needed (the JDK installer for some reason does not work for me). Does anyone have any suggestions on what this problem may be related to?