"required class was missing" during Maven sonar scanning

We recently upgraded our SonarQube instance from 8.2.0.32929->8.3.1.34397. After upgrading, our builds are failing for one of our applications with the error below. Builds don’t fail when we don’t include Sonar (mvn clean verify sonar:sonar vs mvn clean verify). Our code hasn’t changed and I don’t see anything that seems like it’d be related to this in the SonarQube release notes for 8.3.0 or 8.3.1. I did go through and make sure our plugins were all updated and verified that all of the quality profiles we’re using are either “Sonar way” or differ from “Sonar way” in very minor ways.

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] <build list omitted>
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  05:21 min
[INFO] Finished at: 2020-06-24T11:16:55-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar (default-cli) on project assist: Execution default-cli of goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar failed: A required class was missing while executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar: javax/servlet/jsp/jstl/core/ConditionalTagSupport
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.codehaus.mojo:sonar-maven-plugin:3.7.0.1746
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/Users/cwilliams/.m2/repository/org/sonarsource/scanner/maven/sonar-maven-plugin/3.7.0.1746/sonar-maven-plugin-3.7.0.1746.jar
[ERROR] urls[1] = file:/Users/cwilliams/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.jar
[ERROR] urls[2] = file:/Users/cwilliams/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[3] = file:/Users/cwilliams/.m2/repository/org/codehaus/plexus/plexus-utils/3.2.1/plexus-utils-3.2.1.jar
[ERROR] urls[4] = file:/Users/cwilliams/.m2/repository/org/sonarsource/scanner/api/sonar-scanner-api/2.14.0.2002/sonar-scanner-api-2.14.0.2002.jar
[ERROR] urls[5] = file:/Users/cwilliams/.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[maven.api, parent: null]]
[ERROR] 
[ERROR] -----------------------------------------------------
[ERROR] : javax.servlet.jsp.jstl.core.ConditionalTagSupport
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException

As an update, I created duplicate quality profiles in Sonar for all profiles used by this project and disabled every rule so basically we’re running without any quality profile rules but we’re still getting the error.

Hi Team ,

I am facing similar issue , and my sonarqube version 7.9.0 , it was working fine till day after upgrading java analyzer plugin to 6.3 I am seeing these issue . Any solution to this will help a lot.

Hi,
are there any logs of the scanner before the error?

Yes, But I do not see any error in logs ,

|build|25-Jun-2020 11:21:20|[INFO] --- sonar-maven-plugin:3.7.0.1746:sonar (default-cli) @ phts-aggregator ---|
|---|---|---|
|build|25-Jun-2020 11:21:21|[INFO] User cache: C:\Windows\system32\config\systemprofile\.sonar\cache|
|build|25-Jun-2020 11:21:21|[INFO] SonarQube version: 7.9.0|
|build|25-Jun-2020 11:21:21|[INFO] Default locale: "en_US", source code encoding: "windows-1252" (analysis is platform dependent)|
|build|25-Jun-2020 11:21:22|[WARNING] SonarScanner will require Java 11+ to run starting in SonarQube 8.x|
|build|25-Jun-2020 11:21:22|[INFO] Load global settings|
|build|25-Jun-2020 11:21:22|[INFO] Load global settings (done) | time=157ms|
|build|25-Jun-2020 11:21:22|[INFO] Server id: DA1B0E5E-AWQsUlnsZOneZ-lRh7wK|
|build|25-Jun-2020 11:21:22|[INFO] User cache: C:\Windows\system32\config\systemprofile\.sonar\cache|
|build|25-Jun-2020 11:21:22|[INFO] Load/download plugins|
|build|25-Jun-2020 11:21:22|[INFO] Load plugins index|
|build|25-Jun-2020 11:21:22|[INFO] Load plugins index (done) | time=79ms|
|build|25-Jun-2020 11:21:22|[INFO] Load/download plugins (done) | time=235ms|
|build|25-Jun-2020 11:21:23|[INFO] Loaded core extensions: developer-scanner|
|build|25-Jun-2020 11:21:24|[INFO] Process project properties|
|build|25-Jun-2020 11:21:24|[INFO] Execute project builders|
|build|25-Jun-2020 11:21:24|[INFO] Execute project builders (done) | time=16ms|
|build|25-Jun-2020 11:21:24|[INFO] Project key: phtsweb|
|build|25-Jun-2020 11:21:24|[INFO] Base dir: D:\BambooAgent\xml-data\build-dir\SPID-PHTSWEBD-JOB1|
|build|25-Jun-2020 11:21:24|[INFO] Working dir: D:\BambooAgent\xml-data\build-dir\SPID-PHTSWEBD-JOB1\phts-aggregator\target\sonar|
|build|25-Jun-2020 11:21:24|[INFO] Load project settings for component key: 'phtsweb'|
|build|25-Jun-2020 11:21:24|[INFO] Load project branches|
|build|25-Jun-2020 11:21:24|[INFO] Load project branches (done) | time=15ms|
|build|25-Jun-2020 11:21:24|[INFO] Load project pull requests|
|build|25-Jun-2020 11:21:24|[INFO] Load project pull requests (done) | time=16ms|
|build|25-Jun-2020 11:21:24|[INFO] Load branch configuration|
|build|25-Jun-2020 11:21:24|[INFO] Load branch configuration (done) | time=0ms|
|build|25-Jun-2020 11:21:24|[INFO] Load quality profiles|
|build|25-Jun-2020 11:21:24|[INFO] Load quality profiles (done) | time=125ms|
|build|25-Jun-2020 11:21:24|[INFO] Load active rules|
|build|25-Jun-2020 11:21:26|[INFO] Load active rules (done) | time=1656ms|
|build|25-Jun-2020 11:21:26|[INFO] Indexing files...|
|build|25-Jun-2020 11:21:26|[INFO] Project configuration:|
|build|25-Jun-2020 11:21:26|[INFO] Indexing files of module 'PHTS-WEB'|
|build|25-Jun-2020 11:21:26|[INFO]   Base dir: D:\BambooAgent\xml-data\build-dir\SPID-PHTSWEBD-JOB1\phts-ear|
|build|25-Jun-2020 11:21:26|[INFO]   Source paths: pom.xml|
|build|25-Jun-2020 11:21:26|[INFO] Indexing files of module 'PHTS-WEB'|
|build|25-Jun-2020 11:21:26|[INFO]   Base dir: D:\BambooAgent\xml-data\build-dir\SPID-PHTSWEBD-JOB1\phts-jar|
|build|25-Jun-2020 11:21:26|[INFO]   Source paths: pom.xml, src/main/java|
|build|25-Jun-2020 11:21:26|[INFO] Indexing files of module 'PHTS-WEB'|
|build|25-Jun-2020 11:21:26|[INFO]   Base dir: D:\BambooAgent\xml-data\build-dir\SPID-PHTSWEBD-JOB1\phtsapp-web|
|build|25-Jun-2020 11:21:26|[INFO]   Source paths: src/main/webapp, pom.xml, src/main/java|
|build|25-Jun-2020 11:21:26|[INFO] Load project repositories|
|build|25-Jun-2020 11:21:26|[INFO] Load project repositories (done) | time=16ms|
|build|25-Jun-2020 11:21:27|[INFO] Indexing files of module 'PHTS-WEB'|
|build|25-Jun-2020 11:21:27|[INFO]   Base dir: D:\BambooAgent\xml-data\build-dir\SPID-PHTSWEBD-JOB1|
|build|25-Jun-2020 11:21:27|[INFO]   Source paths: phts-aggregator/pom.xml|
|build|25-Jun-2020 11:21:27|[INFO] 400 files indexed|
|build|25-Jun-2020 11:21:27|[INFO] Quality profile for css: Sonar way|
|build|25-Jun-2020 11:21:27|[INFO] Quality profile for java: Sonar way|
|build|25-Jun-2020 11:21:27|[INFO] Quality profile for js: Sonar way|
|build|25-Jun-2020 11:21:27|[INFO] Quality profile for jsp: FindBugs Security JSP|
|build|25-Jun-2020 11:21:27|[INFO] Quality profile for xml: Sonar way|
|build|25-Jun-2020 11:21:27|[INFO] ------------- Run sensors on module PHTS-WEB|
|build|25-Jun-2020 11:21:27|[INFO] Load metrics repository|
|build|25-Jun-2020 11:21:27|[INFO] Load metrics repository (done) | time=31ms|
|build|25-Jun-2020 11:21:30|[INFO] Sensor SonarCSS Rules [cssfamily]|
|build|25-Jun-2020 11:21:30|[INFO] No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped.|
|build|25-Jun-2020 11:21:30|[INFO] Sensor SonarCSS Rules [cssfamily] (done) | time=0ms|
|build|25-Jun-2020 11:21:30|[INFO] Sensor JavaXmlSensor [java]|
|build|25-Jun-2020 11:21:30|[INFO] 1 source files to be analyzed|
|build|25-Jun-2020 11:21:31|[INFO] Sensor JavaXmlSensor [java] (done) | time=218ms|
|build|25-Jun-2020 11:21:31|[INFO] 1/1 source files have been analyzed|
|build|25-Jun-2020 11:21:31|[INFO] Sensor HTML [web]|
|build|25-Jun-2020 11:21:31|[INFO] Sensor HTML [web] (done) | time=0ms|
|build|25-Jun-2020 11:21:31|[INFO] Sensor XML Sensor [xml]|
|build|25-Jun-2020 11:21:31|[INFO] 1 source files to be analyzed|
|build|25-Jun-2020 11:21:31|[INFO] Sensor XML Sensor [xml] (done) | time=188ms|
|build|25-Jun-2020 11:21:31|[INFO] Sensor JaCoCo XML Report Importer [jacoco]|
|build|25-Jun-2020 11:21:31|[INFO] 1/1 source files have been analyzed|
|build|25-Jun-2020 11:21:31|[INFO] 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml|
|build|25-Jun-2020 11:21:31|[INFO] No report imported, no coverage information will be imported by JaCoCo XML Report Importer|
|build|25-Jun-2020 11:21:31|[INFO] Sensor JaCoCo XML Report Importer [jacoco] (done) | time=16ms|
|build|25-Jun-2020 11:21:31|[INFO] ------------- Run sensors on module PHTS-WEB|
|build|25-Jun-2020 11:21:31|[INFO] Sensor JavaSquidSensor [java]|
|build|25-Jun-2020 11:21:31|[INFO] Configured Java source version (sonar.java.source): 8|
|build|25-Jun-2020 11:21:31|[INFO] JavaClasspath initialization|
|build|25-Jun-2020 11:21:31|[INFO] JavaClasspath initialization (done) | time=16ms|
|build|25-Jun-2020 11:21:31|[INFO] JavaTestClasspath initialization|
|build|25-Jun-2020 11:21:31|[INFO] JavaTestClasspath initialization (done) | time=0ms|
|error|25-Jun-2020 11:21:31|Jun 25, 2020 11:21:31 AM org.apache.jasper.servlet.TldScanner scanJars|
|error|25-Jun-2020 11:21:31|INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.|
|build|25-Jun-2020 11:21:32|[INFO] ------------------------------------------------------------------------|
|build|25-Jun-2020 11:21:32|[INFO] Reactor Summary:|
|build|25-Jun-2020 11:21:32|[INFO] |
|build|25-Jun-2020 11:21:32|[INFO] Product HIOS Translation System Aggregator Project . FAILURE [ 11.422 s]|
|build|25-Jun-2020 11:21:32|[INFO] phts-jar ........................................... SKIPPED|
|build|25-Jun-2020 11:21:32|[INFO] phtsapp-web Maven Webapp ........................... SKIPPED|
|build|25-Jun-2020 11:21:32|[INFO] phts Ear Project ................................... SKIPPED|
|build|25-Jun-2020 11:21:32|[INFO] ------------------------------------------------------------------------|
|build|25-Jun-2020 11:21:32|[INFO] BUILD FAILURE|
|build|25-Jun-2020 11:21:32|[INFO] ------------------------------------------------------------------------|
|build|25-Jun-2020 11:21:32|[INFO] Total time: 11.969 s|
|build|25-Jun-2020 11:21:32|[INFO] Finished at: 2020-06-25T11:21:32-04:00|
|build|25-Jun-2020 11:21:32|[INFO] Final Memory: 50M/900M|
|build|25-Jun-2020 11:21:32|[INFO] ------------------------------------------------------------------------|
|build|25-Jun-2020 11:21:32|[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar (default-cli) on project phts-aggregator: Execution default-cli of goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar failed: A required class was missing while executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar: javax/servlet/jsp/jstl/core/ConditionalTagSupport|
|build|25-Jun-2020 11:21:32|[ERROR] -----------------------------------------------------|
|build|25-Jun-2020 11:21:32|[ERROR] realm =    plugin>org.codehaus.mojo:sonar-maven-plugin:3.7.0.1746|
|build|25-Jun-2020 11:21:32|[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy|
|build|25-Jun-2020 11:21:32|[ERROR] urls[0] = file:/d:/MavenRepo/org/sonarsource/scanner/maven/sonar-maven-plugin/3.7.0.1746/sonar-maven-plugin-3.7.0.1746.jar|
|build|25-Jun-2020 11:21:32|[ERROR] urls[1] = file:/d:/MavenRepo/org/sonatype/plexus/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.jar|
|build|25-Jun-2020 11:21:32|[ERROR] urls[2] = file:/d:/MavenRepo/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar|
|build|25-Jun-2020 11:21:32|[ERROR] urls[3] = file:/d:/MavenRepo/org/codehaus/plexus/plexus-utils/3.2.1/plexus-utils-3.2.1.jar|
|build|25-Jun-2020 11:21:32|[ERROR] urls[4] = file:/d:/MavenRepo/org/sonarsource/scanner/api/sonar-scanner-api/2.14.0.2002/sonar-scanner-api-2.14.0.2002.jar|
|build|25-Jun-2020 11:21:32|[ERROR] urls[5] = file:/d:/MavenRepo/commons-lang/commons-lang/2.6/commons-lang-2.6.jar|
|build|25-Jun-2020 11:21:32|[ERROR] Number of foreign imports: 1|
|build|25-Jun-2020 11:21:32|[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]|
|build|25-Jun-2020 11:21:32|[ERROR] |
|build|25-Jun-2020 11:21:32|[ERROR] -----------------------------------------------------: javax.servlet.jsp.jstl.core.ConditionalTagSupport|
|build|25-Jun-2020 11:21:32|[ERROR] -> [Help 1]|
|build|25-Jun-2020 11:21:32|[ERROR] |
|build|25-Jun-2020 11:21:32|[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.|
|build|25-Jun-2020 11:21:32|[ERROR] Re-run Maven using the -X switch to enable full debug logging.|
|build|25-Jun-2020 11:21:32|[ERROR] |
|build|25-Jun-2020 11:21:32|[ERROR] For more information about the errors and possible solutions, please read the following articles:|
|build|25-Jun-2020 11:21:32|[ERROR] [Help 1] http|

The issue can be fixed by updating jstl 1.2 package.
Jstl has been split into multiple packages. Remove Jstl 1.2 from your pom and add

org.apache.taglibs
taglibs-standard-impl
1.2.5
compile
false


org.apache.taglibs
taglibs-standard-spec
1.2.5
compile
false

This fixes the issues.

1 Like

Thank you, I have tried to add below snipet in my pom.xml

<dependency>
			<!--<groupId>javax.servlet</groupId>
			<artifactId>jstl</artifactId>
			<version>1.1.2</version> -->
			 <groupId>org.apache.taglibs</groupId>
    		<artifactId>taglibs-standard-impl</artifactId>
    		<version>1.2.5</version>
          <scope>compile</scope>  
            <optional>false</optional>
		</dependency>
      <dependency>
			<groupId>org.apache.taglibs</groupId>
    		<artifactId>taglibs-standard-spec</artifactId>
    		<version>1.2.5</version>
               <scope>compile</scope>  
               <optional>false</optional>
		</dependency>
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>servlet-api</artifactId>
			<version>2.5</version>
			<scope>provided</scope>
		</dependency>

Still same issue …

Hi,
Do you have any custom rules?

Hi,

Thank you, we do not have any custom rule, This project was working fine till last week, after upgrading Java analyzer plugin we are seeing this issue . .

Sachidananda

hello @sachidananda, @chrisw

thank you for reporting this issue, it allowed us to identify problem in our Java analyzer. I created the ticket to fix it https://jira.sonarsource.com/browse/SONARJAVA-3452 .

The workaround is either to change the dependencies as you suggested, or exclude JSP files from the analysis using sonar.exclusions property.

2 Likes

Thanks for the quick response. I’ve added a property in my top-level pom file:

<properties>
	<sonar.exclusions>**/*.jsp</sonar.exclusions>
</properties>

This looks like it’s being picked up. I see stuff like this in the logs:

[ **INFO** ] Project configuration:
[ **INFO** ] Excluded sources: **/*.jsp
[ **INFO** ] Indexing files of module 'xxx Model'
[ **INFO** ] Base dir: /Users/cwilliams/dev/xxx/xxx/xxx-api/xxx-model
[ **INFO** ] Source paths: pom.xml, src/main/java
[ **INFO** ] Test paths: src/test/java
[ **INFO** ] Excluded sources: **/*.jsp
[ **INFO** ] Indexing files of module 'xxx Web Service Client'
[ **INFO** ] Base dir: /Users/cwilliams/dev/xxx/xxx/xxx-api/xxx-client
[ **INFO** ] Source paths: pom.xml, src/main/java
[ **INFO** ] Test paths: src/test/java
[ **INFO** ] Excluded sources: **/*.jsp

Still getting the same error when running:

man sonar:sonar clean verify

Can you share the logs on debug level (mvn -X verify sonar:sonar) ? There should be a line just before the exception like Transpiling JSP .... , this should identify the file we want to ignore.

@sachidananda do you also have javaee-web-api dependency in your pom? If so make sure that taglibs dependencies are listed before the javaee-web-api

Thank you , we do not use javaee-web-api dependency on our pom , After excluding JSP files my build went successfully .