问题描述
我收到此异常 java.lang.NoClassDefFoundError:无法初始化类 org.codehaus.groovy.vmplugin.v7.Java7 和 java.lang.NoClassDefFoundError:无法初始化类 org.codehaus.groovy.reflection.ReflectionCache
) 当我运行 Spring Boot 应用程序时
我正在使用以下工具
STS 3.9.10 发布
打开 JDK 14 64 位
Spring Boot 2.2.5
它在 oracle jdk 上运行良好,但在 openjdk 上运行失败.我没有使用任何常规库.这是基于 maven 的 Spring Boot 项目.
你如何运行应用程序?这可能是因为您使用 Gradle 作为构建系统和 JDK14,并且 Gradle 版本较旧.参考:https://github.com/gradle/gradle/issues/10248>
如果您使用 Gradle Wrapper,请参考 $PROJECT_ROOT/gradle/wrapper/gradle-wrapper.properties
.属性 distributionUrl 应该是:distributionUrl=https://services.gradle.org/distributions/gradle-6.3-bin.zip
如果是旧版本,则更改它,运行 ./gradlew clean build
并重试.
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.
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
. 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.
这篇关于java.lang.NoClassDefFoundError:无法初始化类 org.codehaus.groovy.vmplugin.v7.Java7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!