SonarQube v8.2 Error: While Scanning Simple .net code (javax.xml.parsers.SAXParserFactory etc…)

As I am new to SonarQube Code scanner so need assistance as got stuck with below issue in SonarQube v 8.2.

SonarQube is installed on Windows server and I am trying to scan code form my client machine i.e Window 10.

I am executing from Developer Command Prompt for VS 2015

So far as per suggested solutions, I have updated my client machine with Java version to 11 SE, JDK 12, also placed apache-ant-1.10.7-bin and add in path, then also try by adding xercesImpl-2.12.1.jar in ant path but nothing work out so far.

JRE version: jre-8u251-windows-i586

I try to find out solution on forums but unable to find so… Kindly guide how to get rid from this error and run scanner successfully.

Thanks in advance.

Detail Steps are as below:

Initial two steps went fine i.e (1) Execute First Command:

**SonarScanner.MSBuild.exe begin /k:"SomeConsoleapplication"**  
Result are fine as below Pre-processing started. Preparing working directories... 
00:55:48.687 Updating build integration targets... 
00:55:48.703 Fetching analysis configuration settings... 
00:55:51.86 Provisioning analyzer assemblies for cs... 
00:55:51.864 Installing required Roslyn analyzers... 
00:55:52.718 Provisioning analyzer assemblies for vbnet... 
00:55:52.722 Installing required Roslyn analyzers... 
00:55:52.822 Pre-processing succeeded.

(2) Execute Second command: msbuild (to build project)

Results: Build succeeded. (with warnings but all fine)

(3) Problematic Step

SonarScanner.MSBuild.exe end

Results:

SonarScanner for MSBuild 4.2 Using the .NET Framework version of the Scanner for MSBuild Default properties file was found at C:\ProgramData\chocolatey\lib\msbuild-sonarqube-runner\tools\SonarQube.Analysis.xml 
Loading analysis properties from C:\ProgramData\chocolatey\lib\msbuild-sonarqube-runner\tools\SonarQube.Analysis.xml 
Post-processing started. 
SONAR_SCANNER_OPTS is not configured. 
Setting it to the default value of -Xmx1024m 
Calling the SonarQube Scanner... 
INFO: Scanner configuration file: C:\ProgramData\chocolatey\lib\msbuild-sonarqube-runner\tools\sonar-scanner-3.1.0.1141\bin..\conf\sonar-scanner.properties 
INFO: Project root configuration file: D:\Azure DevOps\Repos\Demo New Project.sonarqube\out\sonar-project.properties 
INFO: SonarQube Scanner 3.1.0.1141 INFO: Java 12 Oracle Corporation (64-bit) 
INFO: Windows 10 10.0 amd64 
INFO: SONAR_SCANNER_OPTS=-Xmx1024m 
INFO: User cache: C:\Users**********.sonar\cache 
INFO: SonarQube server 8.2.0 
INFO: Default locale: "en_US", source code encoding: "UTF-8"

INFO: ------------------------------------------------------------------------

INFO: EXECUTION FAILURE 
INFO: ------------------------------------------------------------------------ 
INFO: Total time: 1.242s 
INFO: Final Memory: 3M/14M 
INFO: ------------------------------------------------------------------------ 
ERROR: Error during SonarQube Scanner execution 
ERROR: Provider for class javax.xml.parsers.SAXParserFactory cannot be created 
ERROR: Caused by: Provider for class javax.xml.parsers.SAXParserFactory cannot be created 
ERROR: Caused by: javax.xml.parsers.SAXParserFactory: Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not found 
ERROR:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging. The SonarQube Scanner did not complete successfully 
01:06:30.517 Creating a summary markdown file... 
01:06:30.521 Post-processing failed. Exit code: 1

hi @mhassan

welcome to this community forum!

could you please download the latest version of Scanner for MSBuild and try again? version 4.2 is quite old.

You can always check the latest version on the documentation page: https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-msbuild/

1 Like