java.lang.NoClassDefFoundError: org/springframework/core/env/ConfigurableEnvironment
Recommended Approach
- Go to Spring boot Initialzr site and select web stack as a dependency as shown in below
.
- As Spring Boot uses the concept of Opinionated dependencies and Bill of Materials, It will automatically pull the other dependencies and resolve your classNotFoundException issue. And in your case it misses out the Spring-core-4.2.4.RELEASE.jar dependency.
Execute the Maven Goal as clean install spring-boot:run -e and you can find your maven dependencies in your IDE and below given is a sample POM file.
<?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</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</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.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
< /dependency>
</dependencies>
<build>
<finalName>demo</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
getting java.lang.NoClassDefFoundError: org/springframework/core/env/DefaultEnvironment
use this
<constructor-arg type="java.lang.String" value="Zara"/>
Type definition is required when you use String.
Spring Boot ClassNotFoundException org.springframework.core.metrics.ApplicationStartup
I was able to solve this by downgrading Spring Boot:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.3.3.RELEASE</version>
</dependency>
Guess it's just not compatible with 2.4.0 yet.
Specifically I also had to ensure that I used 2.3.3.RELEASE and not anything more recent due to other issues I ran across.
Spring class EnvironmentCapable
I think that need use version 3.1.0 - in package org.springframework.core-3.1.0.M2.jar this class presents.
Related Topics
How to Print Out All the Elements of a List in Java
Java Fast Food Menu (Using Methods)
How to Disable Log4J Logging from Java Code
Remove Duplicate Values from Hashmap in Java
Selecting from Div Class Dropdown - Selenium
Java.Lang.Noclassdeffounderror: Org/Json/Simple/Parser/Parseexception With Eclipse and Spring
Open Pdf from Bytes Array in Angular 5
Return Json Object from a Spring-Boot Rest Controller
How to Write Multiple Line Property Value Using Propertiesconfiguration
Why Does Intellij Idea Suddenly Not Recognize Tests in Test Folder Anymore
Calculate the Number of Items Displayed by Recyclerview and Place in a Textview
Jsp and CSS File Not Loading in Browser Java Webapp
How to Call a Database Function Using Spring Data Jpa
How to Pass List in Postman in Get Request and Get in Getmapping
Is There an Invisible Character That Is Not Regarded as Whitespace