SonarQube scan fails after upgrade to newest SonarScanner version

Hey guys

We have SonarQube placed in internal network, so to connect from GitHub we are using Self-Hosted runner. Since Friday our jobs are failing with following 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

By analyzing the logs I have noticed, that between Thursday and Friday Sonarscanner and Java version has changed

Thursday logs:

SonarScanner 4.8.0.2856

Java 11.0.20 Alpine (64-bit)

Friday logs:

SonarScanner 5.0.0.2966

Java 17.0.7 Alpine (64-bit)

It seems that, Warning mentioned in this thread is now throwing Errors with new Java version. Which makes sense, as we can see this warning in Thursday logs, in the same line where errors mentioned earlier occurred

WARNING: Illegal reflective access by net.sf.cglib.core.ReflectUtils$1 (file:/opt/sonar-scanner/.sonar/cache/a89f1943fc75b65becd9fb4ecab8d913/sonar-tsql-plugin.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte,int,int,java.security.ProtectionDomain)

What can be done in this case, can we somehow configure in code or properties to downgrade used Java version?

Cheers
Bartek

P.S. Our workflow is below:

on:	
  workflow_dispatch:	
    inputs:	
      logLevel:	
        description: 'Log level'     	
        required: true	
        default: 'warning'	
      tags:	
        description: 'Test scenario tags'	
  schedule:	
    - cron: '20 2 * * *'	
jobs:	
  sonarqube:	
    name: SonarQube Trigger	
    runs-on: self-hosted	
    steps:	
    - name: Checking out	
      uses: actions/checkout@v2	
      with:	
        fetch-depth: 0	
        ref: AP2PROD
    - name: SonarQube Scan	
      uses: sonarsource/sonarqube-scan-action@master	
      with:	
        projectBaseDir: force-app/main/default	
        args: >	
          -Dsonar.branch.name=AP2PROD
      env:	
        SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}	
        SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST }}

What version of SonarQube are you using? It should be located in the footer of your instance.

Take a look here.

We have 8.4 version:

  • Enterprise Edition
  • Version 8.4.1 (build 35646)

Thank you for suggestion, I will try to upgrade SonarQube

1 Like