Issue happens running both locally (Macbook) and on GitLab CI.
I have tried a multitude of various versions of the sonar plugin and also gradle, but still see this error.
I also tried including kotlin on various gradle classpaths (org.jetbrains.kotlin:kotlin-stdlib:2.0.20), and the error still appears, then I realised the stack trace includes āIsolatedClassloaderā, which tells me that was never going to work anyway.
Despite the error, I still see all the subprojects being reported in the Sonarqube UI for our organisation, so I donāt know how this error impacts sonar reporting.
Error observed:
Exception in thread "OkHttp TaskRunner" java.lang.NoClassDefFoundError: kotlin/jvm/internal/Ref$IntRef
at okhttp3.internal.http2.Http2Connection.shutdown(Http2Connection.kt:419)
at okhttp3.internal.http2.Http2Connection.close$okhttp(Http2Connection.kt:449)
at okhttp3.internal.http2.Http2Connection$ReaderRunnable.invoke(Http2Connection.kt:627)
at okhttp3.internal.http2.Http2Connection$ReaderRunnable.invoke(Http2Connection.kt:609)
at okhttp3.internal.concurrent.TaskQueue$execute$1.runOnce(TaskQueue.kt:98)
at okhttp3.internal.concurrent.TaskRunner.runTask(TaskRunner.kt:116)
at okhttp3.internal.concurrent.TaskRunner.access$runTask(TaskRunner.kt:42)
at okhttp3.internal.concurrent.TaskRunner$runnable$1.run(TaskRunner.kt:65)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.ClassNotFoundException: kotlin.jvm.internal.Ref$IntRef
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:476)
at org.sonarsource.scanner.api.internal.IsolatedClassloader.loadClass(IsolatedClassloader.java:82)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:527)
... 11 more
This problem was most likely fixed by SONARKT-372, which removed our use of the Gradle Tooling API to detect build scripts. This was introduced in SonarQube v10.4.
With this exception present, the worst-case scenario is that these rules are not applied to your Gradle files.
I donāt have a workaround in mind to prevent this error if you canāt move SonarQube versions, but (likely?) adding an exclusion like sonar.exclusions=**/*.gradle.kts should get rid of the error. If you werenāt previously aware, your Gradle files were being analyzed (most users arenāt)ā¦ this might be a good option.
Thanks for the update @tony.ap.2024. Unfortunately I donāt have a project/environment where I reproduce the issue, so thereās not much I can suggest other than ignore the error for now.
Hello Colin, just ran into the same issue: s. GitHub action run.
Tried already to exclude build files with: property("sonar.exclusions", "**/gradle.build.kts,**/buildSrc/**").
Iāve create a new branch āsonarscannerā which I can leave there for a whileā¦
best regards
The problem seems to happen during the taint analysis execution. If you donāt care about the taint analysis, you can disable the following rules: S2076, S2078, S2083, S2091, S2631, S3649, S5131, S5135, S5144, S5145, S5146, S5147, S5334, S5496, S5883, S6096, S6173, S6287, S6350, S6384, S6390, S6398, S6399, S6547, S6549, S7044. It should solve your problem.
Otherwise, I will forward it to the team responsible for the taint analysis so they can investigate further. Let them know if you need more help.
unfortunately, I was not able to reproduce this problem yet.
Likely unrelated to the error but worth a try: seeing your linked branch, the Sonar task does not seem to be correctly configured for a multi-project Gradle project. See SonarScanner for Gradle . You need to apply the sonarqube plugin in your main build.gradle.kts and move the settings there too.