Sonarqube failing with JDK 1.8

Hi Team,

After updating the JAVA_HOME to 1.8 and PATH to 1.8, we have started getting below error during Sonar Scan.

Please note the same Sonar Scan runs fine when it points to openJDK 11.

Below Stack versions were used:
Sonar: 8.4.1 Community Edition
JAVA: 1.8
Maven: 3.6.3

Please suggest.

Element Name: moduleSharedVariable

Element Name: jobSharedVariable

[INFO] Searching for BW Process files

[INFO] ------------------------------------------------------------------------


[INFO] ------------------------------------------------------------------------

[INFO] Total time: 01:34 min

[INFO] Finished at: 2020-10-26T21:13:36-07:00

[INFO] ------------------------------------------------------------------------

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin: (default-cli) on project xxxxxxx: Execution default-cli of goal org.sonarsource.scanner.maven:sonar-maven-plugin: failed: An API incompatibility was encountered while executing org.sonarsource.scanner.maven:sonar-maven-plugin: java.lang.NoSuchMethodError: javax.xml.parsers.SAXParserFactory.newDefaultInstance()Ljavax/xml/parsers/SAXParserFactory;

[ERROR] -----------------------------------------------------

[ERROR] realm = plugin>org.codehaus.mojo:sonar-maven-plugin:

[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy

[ERROR] urls[0] = file:/xx/.m2/repository/org/sonarsource/scanner/maven/sonar-maven-plugin/

[ERROR] urls[1] = file:/xx/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.jar

[ERROR] urls[2] = file:/xx/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar

[ERROR] urls[3] = file:/xx/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.22/plexus-utils-3.0.22.jar

[ERROR] urls[4] = file:/xx/.m2/repository/org/sonarsource/scanner/api/sonar-scanner-api/

[ERROR] urls[5] = file:/xx/.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[project>, parent: ClassRealm[maven.api, parent: null]]]



Hi @Poonam_Parihari,

Are you possibly using a third-party plugin (maybe the TIBCO BusinessWorks analyzer)? If so, you’ll need to check the dependencies of that plugin – it may require JDK 11 on the scanner side.



Hi @Cameron,

So sonarqube/sonarscanner has no dependancy with JDK1.8?


Hi Poonam,

SonarQube (from 7.9 onwards) requires JDK 11. The SonarQube CLI scanner can usually run with either JDK 8 or JDK 11. My guess here is that a non-SonarSource plugin is imposing a requirement of JDK 11 on the scanner.