Azure Gradle Sonarqube analysis: NoClassDefFoundError iac EEIac Plugin

Must-share information (formatted with Markdown):
Version Info:
Sonarqube server - Developer Edition - v2025.1 (102418) - [ACTIVE] - MQR MODE

Self-hosted:

What we want to achieve
We want to integrate Sonar Azure Extension in PR pipeline and we’re using SonarPrepare and SonarPublish extensions along with sonarQubeRunAnalysis flag in the Gradle task. We’ve a service connection running.

It was working before
this pipeline was working with no change in our old server version - 9.9 LTS. It broke after moving to latest LTS version.

Pipeline code

  - task: SonarQubePrepare@7
    inputs:
      SonarQube: 'My Sonarqube'
      scannerMode: 'Other'
      extraProperties: 'sonar.projectKey=<ProjectName>'
  - task: Gradle@3
    inputs:
      sonarQubeRunAnalysis: true
      sonarQubeGradlePluginVersion: '6.0.1.5171'
      gradleWrapperFile: 'gradlew'
      tasks: 'build'
  - task: SonarQubePublish@7
    inputs:
      pollingTimeoutSec: '300'

Crash stacktrace

[stderr] Exception in thread "main" java.lang.NoClassDefFoundError: com/sonarsource/plugins/license/api/LicensedPluginRegistration
[stderr]   at com.sonar.plugins.iac.EEIacPlugin.define(Unknown Source)
[stderr]   at org.sonar.scanner.bootstrap.ExtensionInstaller.installExtensionsForPlugins(ExtensionInstaller.java:64)
[stderr]   at org.sonar.scanner.bootstrap.ExtensionInstaller.install(ExtensionInstaller.java:51)
[stderr]   at org.sonar.scanner.bootstrap.SpringScannerContainer.addScannerExtensions(SpringScannerContainer.java:179)
[stderr]   at org.sonar.scanner.bootstrap.SpringScannerContainer.doBeforeStart(SpringScannerContainer.java:157)
[stderr]   at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:224)
[stderr]   at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:205)
[stderr]   at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(SpringGlobalContainer.java:142)
[stderr]   at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:226)
[stderr]   at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:205)
[stderr]   at org.sonar.scanner.bootstrap.ScannerMain.runScannerEngine(ScannerMain.java:151)
[stderr]   at org.sonar.scanner.bootstrap.ScannerMain.run(ScannerMain.java:66)
[stderr]   at org.sonar.scanner.bootstrap.ScannerMain.main(ScannerMain.java:52)
[stderr] Caused by: java.lang.ClassNotFoundException: com.sonarsource.plugins.license.api.LicensedPluginRegistration
[stderr]   at org.sonar.classloader.ParentFirstStrategy.loadClass(ParentFirstStrategy.java:39)
[stderr]   at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:97)
[stderr]   at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:86)
[stderr]   ... 13 more
> Task :sonarqube FAILED

We use paid developer edition but don’t have active support so we’re really looking forward to get some help from this community as we’re stuck on moving from 9.9 to latest version for a while.

Thank you.

Hey there.

The error that you’re getting:

Is the result of trying to install “licensed” (commercial) plugins on top of a non-commercial (Community Edition/Build) instance of SonarQube.

What do you mean by this, and what exactly is happening to the install directories? It sounds like somehow the installations are getting mixed up.

We have installed the developer edition on top of the community edition. 9.9LTA worked ok but using the sonarscanner still getting errors. Is there any documentation on upgrading from community to developer edition using a zip file or is this not supported anymore?

I’m still not sure what you mean by on top of – there are two separate zip files containing separate binaries and dependencies. They aren’t additive, and they should not be mixed.

We have the AMI bitnami-sonarqube-25.1.0-0-linux-debian-12-x86_64-hvm-ebs-nami which already has community preinstalled and working. We download the developer edition zip extract and repoint to the new developer edition. which runs ok as a server, but when trying to use sonarscanner fails to recognise it’s developer edition which I don’t understand as the server shows it self as the developer edition. There’s no predefined AMIs I can find in AWS us-east-1 region for developer edition. Would docker preset developer edition images be an alternative?

Hello @Colin,

We appreciate the help you’re providing with this issue.

Not sure if you see the last reply from Simon. Do you have any suggestion or feedback based on that reply?

Thanks.

Hey all.

No need to ping. :slight_smile: It’s a busy community, and we’re doing our best. Feel free to contribute to the Community and free up some of our time. :wink:

What I said here:

Turns out to be half-true. In fact, these days you can’t even get your SonarQube Community Build instance started up if you try to install a commercial plugin. You get the same error as you’re getting now on the scanner-side, but server-side!

2025.02.14 18:24:25 ERROR web[][o.s.s.p.Platform] Background initialization failed. Stopping SonarQube
java.lang.IllegalStateException: Fail to load plugin IaC Code Quality and Security [iacenterprise]
        at org.sonar.server.plugins.ServerExtensionInstaller.installExtensions(ServerExtensionInstaller.java:81)
        at org.sonar.server.platform.platformlevel.PlatformLevel4.start(PlatformLevel4.java:760)
        at org.sonar.server.platform.PlatformImpl.start(PlatformImpl.java:217)
        at org.sonar.server.platform.PlatformImpl.startLevel34Containers(PlatformImpl.java:197)
        at org.sonar.server.platform.PlatformImpl$AutoStarterRunnable.runIfNotAborted(PlatformImpl.java:365)
        at org.sonar.server.platform.PlatformImpl$1.doRun(PlatformImpl.java:116)
        at org.sonar.server.platform.PlatformImpl$AutoStarterRunnable.run(PlatformImpl.java:349)
        at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.lang.NoClassDefFoundError: com/sonarsource/plugins/license/api/LicensedPluginRegistration
        at com.sonar.plugins.iac.EEIacPlugin.define(Unknown Source)
        at org.sonar.server.plugins.ServerExtensionInstaller.installExtensions(ServerExtensionInstaller.java:71)
        ... 7 common frames omitted
Caused by: java.lang.ClassNotFoundException: com.sonarsource.plugins.license.api.LicensedPluginRegistration
        at org.sonar.classloader.ParentFirstStrategy.loadClass(ParentFirstStrategy.java:39)
        at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:97)
        at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:86)
        ... 9 common frames omitted

The more I investigate, the more I suspect this might be a client-side issue—something cached on the build agent (the “scanner engine,” to get technical about it).

A couple of questions:

  • Is this a self-hosted build agent?
    • If so, I’d suggest you wipe the Scanner cache from that machine. You can find the cache by turning on DEBUG SonarScanner logs (sonar.verbose=true under your SonarQubePrepare task)
    • 18:18:45.114 DEBUG User cache: /Users/colin/.sonar/cache
  • Let’s say you run the scanner from a local machine, do you get the same issue or a successful analysis?
  • And finally, if none of this is working, what is the result of browsing http://<YOUR_SQ_URL/api/v2/analysis/engine/?

Apologies for the ping, Colin. Will keep that in mind and will also look for opportunities to contribute back to the community.

Regarding the questions you asked:

  • Tried running locally using this Gradle command and got the same error
./gradlew sonar -Dsonar.verbose=true -Dsonar.host.url=URL -Dsonar.projectKey=KEY -Dsonar.login=XYZ --debug
  • the result of browsing the v2/analysis/engine is this one:
{"filename":"sonar-scanner-engine-shaded-25.1.0.102122-all.jar","sha256":"6686f239cf7cc859bfa2f7f0655eab8a05451f5296e66723e2cdefd4a6a9ce62"}
  • Yes, it’s self-hosted server using EC2 instance. We will try to wipe the scanner cache on Monday and provide a response here.

Ah, this is super interesting. Because for your Developer Edition of SonarQube, it should be:

scanner-developer-2025.1.0.102418-all.jar

This is the “scanner engine” I mentioned.

This is why I asked earlier:

It seems like the /lib/scanner folder of Community Build (where sonar-scanner-engine-shaded-25.1.0.102122-all.jar lives) hasn’t been replaced by what’s in Developer Edition.

All of that said, however you deploy SonarQube (Bitnami does not support commercial editions of SonarQube), if you’re swapping out edition/version, all files should be overwritten with the new install zip. The previous install should be gone, except maybe your conf/sonar.properties file, and any 3rd-party plugins you install.

Interesting. We will double check if there are files from community version still exist and thus causing the scanner not be the developer edition one.

We get confused by the UI of the dashboard, because that shows developer edition so we assume that everything went well with the upgrade of the server. So is there a way from dashboard to check that sonar scanner is still a wrong version even if the server itself is the developer edition ?

If your installation is in a faulty state (for example, having one file where another should be), it may not be aware of the issue.

In this scenario, one directory of the installation (/lib/scanner) is simply the home for whatever needs to be downloaded by the scanner. Your installation doesn’t care what the file is.

Hello Colin,

Cleaning up lib/scanner folder so only the developer scanner jar file is present helped resolve our issue and scanner is working again.

Thanks a lot for helping out.

We will document our upgrade process now so we can smoothly upgrade in future as well.