spring-bootmavenspring-mvcsonarqubesonar-runner

Making a mvc build with SonarQube token for verify project but we got error as import: Entry [ import from realm ClassRealm[maven.api, parent: null]]


While making a maven build using SonarQube token for verifying the project then I got an error as

INFO BUILD FAILURE INFO------------------------------------------------------------------------ INFO Total time: 11.039 s INFO Finished at: 2023-06-19T16:21:32+05:30 INFO ------------------------------------------------------------------------ ERROR Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar (default-cli) on project report-service: Execution default-cli of goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar failed: An API incompatibility was encountered while executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar: java.lang.ExceptionInInitializerError: null ERROR ----------------------------------------------------- ERROR realm = plugin>org.codehaus.mojo:sonar-maven-plugin:3.9.1.2184 ERROR strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy ERROR urls[0] = file:/C:/Users/Pro_ounce/.m2/repository/org/sonarsource/scanner/maven/sonar-maven-plugin/3.9.1.2184/sonar-maven-plugin-3.9.1.2184.jar ERROR urls[1] = file:/C:/Users/Pro_ounce/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.jar ERROR urls[2] = file:/C:/Users/Pro_ounce/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar ERROR urls[3] = file:/C:/Users/Pro_ounce/.m2/repository/org/codehaus/plexus/plexus-utils/3.2.1/plexus-utils-3.2.1.jar ERROR urls[4] = file:/C:/Users/Pro_ounce/.m2/repository/org/sonarsource/scanner/api/sonar-scanner-api/2.16.2.588/sonar-scanner-api-2.16.2.588.jar ERROR urls[5] = file:/C:/Users/Pro_ounce/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar ERROR Number of foreign imports: 1 ERROR import: Entry[import from realm ClassRealm[maven.api, parent: null]] ERROR ERROR ---------------------------------------------------- ERROR :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 @6f4fc83f ERROR -> [Help 1] ERROR

I tried to remove the jetty dependency and again tested but it's work.


Solution

  • I got the solution for this, please check the Java JDK version which is suitable for the SonarQube version. check-in window -> preferences -> Installed JREs

    enter image description here

    And others also Go to java (or) maven project click on libraries right click on JRE System Library:

    enter image description here