Graylog2 / graylog-project

Packaging/development helper for Graylog
22 stars 25 forks source link

mvn compile does not start (CodeGenerationException) #27

Closed alpha-centauri closed 10 months ago

alpha-centauri commented 10 months ago

I worked with the project in earlier versions and Java 8 in the past. Having switched to the current 5.1 branch of the Graylog2 server project and Java 17, I cannot compile anymore. Is Java 17 the correct java Version?

Maven throws the following errors:

~/project/graylog-project-repos/graylog2-server$ mvn compile
[ERROR] Error executing Maven.
[ERROR] java.lang.IllegalStateException: Unable to load cache item
[ERROR] Caused by: Unable to load cache item
[ERROR] Caused by: Could not initialize class com.google.inject.internal.cglib.core.$MethodWrapper
[ERROR] Caused by: Exception com.google.inject.internal.cglib.core.$CodeGenerationException: java.lang.reflect.InaccessibleObjectException-->Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @2d127a61 [in thread "main"]

Some more info on my dev environment:

$ mvn -version
Apache Maven 3.6.3
Maven home: /usr/share/maven
Java version: 17.0.8.1, vendor: Private Build, runtime: /usr/lib/jvm/java-17-openjdk-amd64
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.15.0-87-generic", arch: "amd64", family: "unix"
janheise commented 10 months ago

@alpha-centauri please try with a newer mvn version. I think that should solve the issue.

alpha-centauri commented 10 months ago

Jan, you are right. It works with Maven 3.9.5. Thank you!