October 24, 2024
Chicago 12, Melborne City, USA
java

maven error: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass


When i try to run my automation test cases using maven, I’m getting the below error. I ran project>run as> maven install

    Failed to execute goal net.serenity-bdd.maven.plugins:serenity-maven-plugin:1.9.16:aggregate (serenity-reports) on project flightmode: Execution serenity-reports of goal net.serenity-bdd.maven.plugins:serenity-maven-plugin:1.9.16:aggregate failed: An API incompatibility was encountered while executing net.serenity-bdd.maven.plugins:serenity-maven-plugin:1.9.16:aggregate: java.lang.ExceptionInInitializerError: null


[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>net.serenity-bdd.maven.plugins:serenity-maven-plugin:1.9.16
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/XXXXX/.m2/repository/net/serenity-bdd/maven/plugins/serenity-maven-plugin/1.9.16/serenity-maven-plugin-1.9.16.jar
[ERROR] urls[1] = file:/C:/XXXX/.m2/repository/net/serenity-bdd/serenity-core/1.9.16/serenity-core-1.9.16.jar
[ERROR] urls[2] = file:/C:/XXXX/.m2/repository/com/google/guava/guava/23.6-jre/guava-23.6-jre.jar
[ERROR] urls[3] = file:/C:/XXXXX/.m2/repository/com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.jar
........

[ERROR] : 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 @7a972f12
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException
  • System Java version: JDK 17.0.12
  • Maven version: 3.8.3

I tried to run using Java 21 also but still I face same issue,
Also added below things in eclipse.ini file, still face same issue

-Djava.security.manager=allow
--illegal-access=warn
--add-opens=java.base/java.lang=ALL-UNNAME



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video