close

[Solved] java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7

Hello Guys, How are you all? Hope You all Are Fine. Today I am facing following error while builds my project java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7 and java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.reflection.ReflectionCache in java. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7 Error Occurs?

I am facing following error while builds my project.

java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7

java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.reflection.ReflectionCache

How To Solve java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7 Error?

  1. How To Solve java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7 Error ?

    To Solve java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7 Error This error occurs might be you use Gradle as the build system and JDK14 and the Gradle version is old. Thats why you are facing this error. So that just change Change distributionUrl in gradle-wrapper.properties and your error will be solved. Change this line, from: distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-all.zip to: distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip Run ./gradlew clean build and try again. Now your error must be solved.

  2. java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7

    To Solve java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7 Error This error occurs might be you use Gradle as the build system and JDK14 and the Gradle version is old. Thats why you are facing this error. So that just change Change distributionUrl in gradle-wrapper.properties and your error will be solved. Change this line, from: distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-all.zip to: distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip Run ./gradlew clean build and try again. Now your error must be solved.

Solution 1: Change distributionUrl in gradle-wrapper.properties

This error occurs might be you use Gradle as the build system and JDK14 and the Gradle version is old. Thats why you are facing this error.

So that just change Change distributionUrl in gradle-wrapper.properties and your error will be solved.

Change this line, from:

distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-all.zip

to:

distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip

Run ./gradlew clean build and try again. Now your error must be solved.

Solution 2: upgrade the spring-cloud-contract-maven-plugin

Just upgrading the spring-cloud-contract-maven-plugin version to 2.2.3-RELEASE and My error solved.

Summary

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also, Read

Leave a Comment