prestodb / presto

The official home of the Presto distributed SQL query engine for big data
http://prestodb.io
Apache License 2.0
15.9k stars 5.32k forks source link

Unable to build: Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7 #19352

Open kireet opened 1 year ago

kireet commented 1 year ago

I am trying to build (on a mac m2). When running maven, an error occurs:

environment info:

$ ./mvnw -X clean install
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /Users/kireet/.m2/wrapper/dists/apache-maven-3.6.3-bin/lm9vem38rfmjij3jj0mk5bvnt/apache-maven-3.6.3
Java version: 20, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk-20.jdk/Contents/Home
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "13.1", arch: "aarch64", family: "mac"

error:

[ERROR] Failed to execute goal com.github.spotbugs:spotbugs-maven-plugin:3.1.10:spotbugs (spotbugs) on project presto-root: Execution spotbugs of goal com.github.spotbugs:spotbugs-maven-plugin:3.1.10:spotbugs failed: Unable to load the mojo 'spotbugs' in the plugin 'com.github.spotbugs:spotbugs-maven-plugin:3.1.10'. A required class is missing: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7

and then

Caused by: java.lang.ExceptionInInitializerError: Exception org.codehaus.groovy.GroovyBugError [in thread "BuilderThread 0"]
    at org.codehaus.groovy.vmplugin.v7.Java7.<clinit> (Java7.java:45)
    at jdk.internal.misc.Unsafe.ensureClassInitialized0 (Native Method)
    at jdk.internal.misc.Unsafe.ensureClassInitialized (Unsafe.java:1160)
    at jdk.internal.reflect.MethodHandleAccessorFactory.ensureClassInitialized (MethodHandleAccessorFactory.java:300)
    at jdk.internal.reflect.MethodHandleAccessorFactory.newConstructorAccessor (MethodHandleAccessorFactory.java:103)
    at jdk.internal.reflect.ReflectionFactory.newConstructorAccessor (ReflectionFactory.java:200)
    at java.lang.reflect.Constructor.acquireConstructorAccessor (Constructor.java:547)
    at java.lang.reflect.Constructor.newInstanceWithCaller (Constructor.java:497)
    at java.lang.reflect.ReflectAccess.newInstance (ReflectAccess.java:128)
    at jdk.internal.reflect.ReflectionFactory.newInstance (ReflectionFactory.java:304)
    at java.lang.Class.newInstance (Class.java:685)
    at org.codehaus.groovy.vmplugin.VMPluginFactory.createPlugin (VMPluginFactory.java:57)
    at org.codehaus.groovy.vmplugin.VMPluginFactory.<clinit> (VMPluginFactory.java:39)
    at org.codehaus.groovy.reflection.GroovyClassValueFactory.<clinit> (GroovyClassValueFactory.java:35)

full log attached. Not sure why it's trying to load something about java 7 or how to fix it. Do I need to downgrade my java installation?

mvn.log

ImTangYun commented 1 year ago

I had met this problem, Try to use jdk 11.0.11 to solve this problem, which work for me

kireet commented 1 year ago

Thanks, this seemed to fix the problem. The docs said "Java 8 Update 151 or higher (8u151+), 64-bit.", which I took to mean any version newer than that, but maybe it meant only newer java 8 versions? Just wondering if I should try to fix this issue, or it's expected as only java 8 is supported.

SupremacyX commented 1 year ago

Same problem,and jdk 11.0.11 can't fix it.

hainenber commented 7 months ago

Quite late to the table but I found out that if you want to run ./mvnw clean install, you first need to point $JAVA_HOME to appropriate SDK firstly 😄