got nerd-sniped and probably not very helpful: I widened the search a bit but still do not really technically understand the cause.
Is it something where the sq-plugin expects a dependency available via maven pom project dependencies and this is not there?
Others cleaned their local maven .m2 cache to remove possibilities of cache failures, others added dependencies to the pom.
As i (try to) understand it right now, this is caused by trying to analyze something and the specific dependencies for this analyzed source needs a specific dependency. also i think “jakarta vs javax” maybe.
sorry for the incoherent ramblings, can anyone with more knowledge maybe chime in?
Maybe this (-X …) mentioned here could help narrow the cause?
tried also cleaning the maven cache and -Dsonar.exclusions=**/*.jsp, didn’t help.
Also the maven-basic example has no JSP files.
Loglevel DEBUG -X didn’t reveal any helpful details - at least for me.
Java 17 and “jakarta vs javax” sounds familiar
I tried to find info about the moment / time when the naming was changed. Found something here:
From a namespace perspective, Jakarta EE 8 still uses the javax.* naming. However, the Jakarta EE 9 release on Dec 8th, 2020, would introduce jakarta.* as the namespace to replace javax.* for Jakarta EE specifications.
I am not very confident that this might lead in the right direction, tho.
Tried also -Dsonar.exclusions=**/*.jsp - as it was mentioned in the community post i found - without success and the maven-basic example from sonarsource github has no JSP files.
So you may use the maven-basic example as reproducer.
Did a quick test on my private machine with Windows 11, Sonarqube Community edition 10.3,
Temurin Java 17.0.9 and Java 17.0.6, OpenJDK 17.0.2 (didn’t find a version 17.0.6), Maven 3.9.6
and the maven-basic example.
openjdk version "17.0.9" 2023-10-17
OpenJDK Runtime Environment Temurin-17.0.9+9 (build 17.0.9+9)
OpenJDK 64-Bit Server VM Temurin-17.0.9+9 (build 17.0.9+9, mixed mode, sharing)
openjdk version "17.0.6" 2023-01-17
OpenJDK Runtime Environment Temurin-17.0.6+10 (build 17.0.6+10)
OpenJDK 64-Bit Server VM Temurin-17.0.6+10 (build 17.0.6+10, mixed mode, sharing)
openjdk version "17.0.2" 2022-01-18
OpenJDK Runtime Environment (build 17.0.2+8-86)
OpenJDK 64-Bit Server VM (build 17.0.2+8-86, mixed mode, sharing)
Windows Server 2019 vs. Windows 11 professional
Sonarqube Enterprise 10.3 vs. Sonarqube Community 10.3
OpenJDK 17.0.6 (from OpenJDK directly i believe) vs. OpenJDK Temurin 17.0.6 / 17.0.9 and OpenJDK 17.0.2
I’ve never had any problems before, when using OpenJDK 17.0.6 and it works great with
Maven 3.9.6 and Sonarqube Enterprise 9.9 LTS.
after all, I’m wondering how this error came about, because the plugin works otherwise.
There are only problems when starting an analysis, i.e. with Maven - didn’t try other scanners.
Does this possibly have something to do with it and maybe it’s fixed with Sonarqube 10.4 !?
it’s the same with Java 17.0.6, Sonarqube Community edition 10.3, the activated plugin and the
Sonar CLI scanner, which results in
ERROR: Error during SonarScanner execution
java.lang.NoClassDefFoundError: javax/servlet/Filter
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(Unknown Source)
at java.base/java.security.SecureClassLoader.defineClass(Unknown Source)
at java.base/java.net.URLClassLoader.defineClass(Unknown Source)
at java.base/java.net.URLClassLoader$1.run(Unknown Source)
at java.base/java.net.URLClassLoader$1.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.net.URLClassLoader.findClass(Unknown Source)
at org.sonarsource.scanner.api.internal.IsolatedClassloader.loadClass(IsolatedClassloader.java:82)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:84)
at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:76)
at org.sonar.classloader.DefaultClassloaderRef.loadClassIfPresent(DefaultClassloaderRef.java:40)
at org.sonar.classloader.ClassRealm.loadClassFromParent(ClassRealm.java:147)
at org.sonar.classloader.ParentFirstStrategy.loadClass(ParentFirstStrategy.java:35)
at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:87)
at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:76)
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(Unknown Source)
at java.base/java.security.SecureClassLoader.defineClass(Unknown Source)
at java.base/java.net.URLClassLoader.defineClass(Unknown Source)
at java.base/java.net.URLClassLoader$1.run(Unknown Source)
at java.base/java.net.URLClassLoader$1.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.net.URLClassLoader.findClass(Unknown Source)
at org.sonar.classloader.ClassRealm.loadClassFromSelf(ClassRealm.java:125)
at org.sonar.classloader.ParentFirstStrategy.loadClass(ParentFirstStrategy.java:37)
at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:87)
at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:76)
at org.sonar.plugins.javamelody.SonarJavaMelodyPlugin.define(SonarJavaMelodyPlugin.java:41)
at org.sonar.scanner.bootstrap.ExtensionInstaller.install(ExtensionInstaller.java:57)
at org.sonar.scanner.scan.SpringProjectScanContainer.addScannerExtensions(SpringProjectScanContainer.java:323)
at org.sonar.scanner.scan.SpringProjectScanContainer.doBeforeStart(SpringProjectScanContainer.java:154)
at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:199)
at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:180)
at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(SpringGlobalContainer.java:139)
at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:201)
at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:180)
at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:71)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:65)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
at com.sun.proxy.$Proxy0.execute(Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
at org.sonarsource.scanner.cli.Main.execute(Main.java:126)
at org.sonarsource.scanner.cli.Main.execute(Main.java:81)
at org.sonarsource.scanner.cli.Main.main(Main.java:62)
Caused by: java.lang.ClassNotFoundException: javax.servlet.Filter
at java.base/java.net.URLClassLoader.findClass(Unknown Source)
at org.sonarsource.scanner.api.internal.IsolatedClassloader.loadClass(IsolatedClassloader.java:82)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
... 52 more
Since we’ve isolated this to SonarQube, I come back to your OP, where the comparison point is 9.9. We dropped a lot of deprecated APIs in 10.0 and I can only guess that’s the underlying cause here.
But… JavaMelody is a monitoring program. Why is it participating in analysis to start with? Is it monitoring analysis performance too? I would have expected it to only monitor the SonarQube server itself.
I ask myself that too, it’s (just) a monitoring plugin - it’s not monitoring analysis performance at all - and it works fine, but there are problems when this plugin is active and i want to do an analysis.
If we/you find the underlying cause, this will be helpful for plugin developers.
We’re making some changes to how plugins are downloaded for analysis (to only download the ones needed for the current project, you’ll be happy to hear). I don’t think any of those changes were started in 10.3. I think it’s all in 10.4. If it did start in 10.3, then my Jira-fu is weak today (not really a shocker).
That said, from a browse through the plugin, it’s not clear to me how this is getting tangled up in analysis. So I’ve flagged this for the product team.