• Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Precios
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

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

I am getting this exception 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) when i run the spring boot application

I am using below tools

STS 3.9.10 release
Open JDK 14 64 bit
Spring boot 2.2.5

It worked fine with oracle jdk but its failing to run with openjdk. I am not using any groovy libs. This is maven based spring boot project.

about 1 year ago · Santiago Trujillo
17 Respuestas
Responde la pregunta

0

In the file android/gradle/wrapper/gradle-wrapper.properties, ensure that the distributionUrl is as follows:

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

Note: If you installed jdk 14

about 1 year ago · Santiago Trujillo Denunciar

0

in my case, the JRE version used in the Run Configuration was different than the target JDK version in the pom.xml

SpringBoot_Run_Config

about 1 year ago · Santiago Trujillo Denunciar

0

If you using Android Studio 4.0 or up and having Errors like below

    Cause: invalid type code: 17
    Cause: invalid type code: fe
    Cause: invalid type code: 13
java.lang.NoClassDefFoundError: Could not initialize class

Or

Its says that something wrong with JDK then Follow below steps to resolve the error.

Step 1: First delete .gradle and .idea folder from project directory and restart Android Studio. Make sure it's gone from recycle bin.

Step 2: Go to Project Structure

Project Structure

Step 3: Select SDK Location from the left panel on Project Structure window.

Step 4: Go to JDK Location and click on down arrow then select the jre instead of jdk

C:\Program Files\Android\Android Studio\jre

JDK Location

And it will Solve the errors. Rebuild the project

Note: jre come with the android studio 4 installation not sure about the older version.

This solution work for me.

about 1 year ago · Santiago Trujillo Denunciar

0

Move to JDK 11, it should work.

about 1 year ago · Santiago Trujillo Denunciar

0

In my case the combination was IntelliJ 2020.2, Kotlin 1.3.72, Maven 3.6.1 and SpringBoot 2.2.1 application. No Gradle used at all in the project.

Somehow IntelliJ had switched to use OpenJDK14 - when reverting back to OpenJDK11 everything started to work again.

about 1 year ago · Santiago Trujillo Denunciar

0

I resolve this problem when integrated Facebook 7.19.2 and Google play Games 0.10.09.

In my case JDK and SDK using (and other in Edit/Preferences/External -> Tools-Android) default paths Unity:

JDK

C:/ProgramFiles/Unity/Hub/Editor/2019.2.12f1/Editor/Data/PlaybackEngines/AndroidPlayer/Tools\OpenJDK\Windows

SDK

C:/Program Files/Unity/Hub/Editor/2019.2.12f1/Editor/Data/PlaybackEngines/AndroidPlayer\SDK

In Environmental Variables(System Proporites/Advanced) added next:

Find(or click new variable under User Variables)

  • JAVA_HOME and add root JDK path.

  • JAVA_BIN and add path JDK/bin

  • JAVA_LIB and add path JDK/lib

Also, add these paths in System Variables to variable "Path".

Do not use SDK from default Unity and JDK from not Unity default

Then Restart Unity(and better PC).

Then in Editor Unity - Assets/Play -> Service -> Resolve/Android -> Resolver/Force -> Resolve

All Work fine.

about 1 year ago · Santiago Trujillo Denunciar

0

Check that your project is running with Java 14 even though it is prepared for Java 8.

My IntelliJ Idea was giving the same error when trying to execute a Gradle task which was running perfectly in command line with JDK 8. The ItelliJ Idea project default JDK was 14 though.

about 1 year ago · Santiago Trujillo Denunciar

0

are you using some third party library that brings in org.codehaus.groovy dependencies? If yes, you can try and replace the required groovy dependencies with the most current releases yourself.

In my case it was the org.liquibase:liquibase-groovy-dsl, so I did this:

    <dependency>
        <groupId>org.liquibase</groupId>
        <artifactId>liquibase-groovy-dsl</artifactId>
        <version>2.1.1</version>
        <exclusions>
            <exclusion>
                <groupId>org.codehaus.groovy</groupId>
                <artifactId>groovy</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.codehaus.groovy</groupId>
                <artifactId>groovy-sql</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>org.codehaus.groovy</groupId>
        <artifactId>groovy</artifactId>
        <version>3.0.3</version>
    </dependency>

    <dependency>
        <groupId>org.codehaus.groovy</groupId>
        <artifactId>groovy-sql</artifactId>
        <version>3.0.3</version>
    </dependency>
about 1 year ago · Santiago Trujillo Denunciar

0

How do you run the application? It's probably because you use Gradle as the build system and JDK14 and the Gradle version is old. Reference: https://github.com/gradle/gradle/issues/10248

If you use Gradle Wrapper then refer to $PROJECT_ROOT/gradle/wrapper/gradle-wrapper.properties. The property distributionUrl should be: distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip

If it's an older version then change it, run ./gradlew clean build and try again.

about 1 year ago · Santiago Trujillo Denunciar

0

Got the same issue on a Maven & SpringBoot project, no Gradle whatever.

The dependency to org.codehaus.groovy is probably transitive through spring-cloud-contract-verifier. Run mvn dependency:tree to view the whole dependency tree.

I got it fixed by upgrading the spring-cloud-contract-maven-plugin version to 2.2.3-RELEASE

about 1 year ago · Santiago Trujillo Denunciar

0

I solved this by selecting Installed JRE path in window => preferences => java => installed JRE => remve existing & select from local directory.

Make sure you have java_home variable set in environmental variable

about 1 year ago · Santiago Trujillo Denunciar

0

I solved it by editing the gradle-wrapper.properties file inside the gradle folder. (Not .gradle) :

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

rebuild and it's ok.

about 1 year ago · Santiago Trujillo Denunciar

0

If you are looking for similar solution as @godsim shared, but for gradle liquabase plugin, then modify your configuration section in build.gradle to exclude liquabase's groovy dependency:

configurations {
    ...
    liquibaseRuntime.exclude group: "org.codehaus.groovy"
}

and then manually add groovy in dependencies section:

dependencies {
    ...
    liquibaseRuntime('org.liquibase:liquibase-core:3.8.1')
    liquibaseRuntime('org.codehaus.groovy:groovy-all:3.0.3')
    liquibaseRuntime 'org.postgresql:postgresql'
    liquibaseRuntime('org.liquibase:liquibase-groovy-dsl:2.1.2')
    liquibaseRuntime('org.liquibase.ext:liquibase-hibernate5:3.10.2')
    liquibaseRuntime('org.springframework.boot:spring-boot-starter-data-jpa')
    liquibaseRuntime sourceSets.main.output
    ...
}
about 1 year ago · Santiago Trujillo Denunciar

0

This issue is solved for me only when I updated compileSdkVersion and targetSdkVersion to 30 with minSdkVersion 19

about 1 year ago · Santiago Trujillo Denunciar

0

Was getting the error when using old versions of spotbugs-maven-plugin plugin and the corresponding spotbugs maven dependency.

Fixed by upgrading both to 4.2.0.

about 1 year ago · Santiago Trujillo Denunciar

0

I fixed this by adding Apache Groovy 2.4.7 in pom.xml

about 1 year ago · Santiago Trujillo Denunciar

0

For Maven users, Please follow the below steps to resolve this issue

  1. You should place rest-assured before the JUnit dependency declaration in your pom.xml / build.gradle in order to make sure that the correct version of Hamcrest is used.
  2. Add the following dependencies to your pom.xml
<dependency>
    <groupId>org.codehaus.groovy</groupId>
    <artifactId>groovy-all</artifactId>
    <version>3.0.8</version>
    <type>pom</type>
</dependency>
<!-- https://mvnrepository.com/artifact/org.codehaus.groovy/groovy -->
<dependency>
    <groupId>org.codehaus.groovy</groupId>
    <artifactId>groovy</artifactId>
    <version>3.0.8</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.codehaus.groovy/groovy-json -->
<dependency>
    <groupId>org.codehaus.groovy</groupId>
    <artifactId>groovy-json</artifactId>
    <version>3.0.8</version>
</dependency>

Hope this will fix your issue. It works for me. Instruction mentioned at step#1 copies from Rest Assured official site. Thanks

about 1 year ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar empleo Precios Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2023 PeakU Inc. All Rights Reserved.