Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sonarqube C# MsBuild Access denied

I have a Sonarqube (6.7.1) server with SonarC# (6.7.1) which is build by Bitnami Google Cloud Platform.

and I followed the tutorial: https://docs.sonarqube.org/display/SCAN/Scanning+on+Linux+or+macOS

created a new and empty project 'ConsoleApp1'

However in the last step: mono ~/Tools/ScannerMSBuild/SonarQube.Scanner.MSBuild.exe end /d:sonar.login=XYZ

It will popup an exception:

Calling the SonarQube Scanner...

Unhandled Exception:
System.ComponentModel.Win32Exception (0x80004005): ApplicationName='/Users/magic/Documents/Projects/services/sonar-scanner-msbuild/sonar-scanner-3.0.3.778/bin/sonar-scanner', CommandLine='"-Dsonar.login=admin" "-Dsonar.scanAllFiles=true" "-Dsonar.password=xxxxxx" "-Dproject.settings=/Users/magic/Documents/Projects/c#/ConsoleApp1/.sonarqube/out/sonar-project.properties"', CurrentDirectory='/Users/magic/Documents/Projects/c#/ConsoleApp1', Native error= Access denied
  at System.Diagnostics.Process.StartWithCreateProcess (System.Diagnostics.ProcessStartInfo startInfo) [0x002dc] in <04fdc8acaa5e466bb267a3960bdb1f37>:0
  at System.Diagnostics.Process.Start () [0x0003a] in <04fdc8acaa5e466bb267a3960bdb1f37>:0
  at (wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start()
  at SonarQube.Common.ProcessRunner.Execute (SonarQube.Common.ProcessRunnerArguments runnerArgs) [0x000df] in <184f94cfa81445e38fb1a98c6eca5c13>:0
  at SonarScanner.Shim.SonarScannerWrapper.ExecuteJavaRunner (SonarQube.Common.AnalysisConfig config, System.Collections.Generic.IEnumerable`1[T] userCmdLineArguments, SonarQube.Common.ILogger logger, System.String exeFileName, System.String propertiesFileName) [0x00053] in <40209c7fedb345b0bc4e48d7b04dc4cc>:0
  at SonarScanner.Shim.SonarScannerWrapper.InternalExecute (SonarQube.Common.AnalysisConfig config, System.Collections.Generic.IEnumerable`1[T] userCmdLineArguments, SonarQube.Common.ILogger logger, System.String fullPropertiesFilePath) [0x0001b] in <40209c7fedb345b0bc4e48d7b04dc4cc>:0
  at SonarScanner.Shim.SonarScannerWrapper+<>c__DisplayClass6_0.<Execute>b__0 () [0x0003a] in <40209c7fedb345b0bc4e48d7b04dc4cc>:0
  at SonarScanner.Shim.SonarProjectPropertiesValidator.Validate (System.String sonarScannerCwd, System.Collections.Generic.ICollection`1[T] projects, System.Action onValid, System.Action`1[T] onInvalid) [0x00082] in <40209c7fedb345b0bc4e48d7b04dc4cc>:0
  at SonarScanner.Shim.SonarScannerWrapper.Execute (SonarQube.Common.AnalysisConfig config, System.Collections.Generic.IEnumerable`1[T] userCmdLineArguments, SonarQube.Common.ILogger logger) [0x00092] in <40209c7fedb345b0bc4e48d7b04dc4cc>:0
  at SonarQube.TeamBuild.PostProcessor.MSBuildPostProcessor.InvokeSonarScanner (SonarQube.Common.IAnalysisPropertyProvider cmdLineArgs, SonarQube.Common.AnalysisConfig config) [0x00013] in <c02c645a99c24060a2edd0cf9161959e>:0
  at SonarQube.TeamBuild.PostProcessor.MSBuildPostProcessor.Execute (System.String[] args, SonarQube.Common.AnalysisConfig config, SonarQube.TeamBuild.Integration.Interfaces.ITeamBuildSettings settings) [0x000c3] in <c02c645a99c24060a2edd0cf9161959e>:0
  at SonarQube.Bootstrapper.BootstrapperClass.PostProcess () [0x00080] in <76e5086a486b4c68925b0809607fa8c1>:0
  at SonarQube.Bootstrapper.BootstrapperClass.Execute () [0x00041] in <76e5086a486b4c68925b0809607fa8c1>:0
  at SonarQube.Bootstrapper.Program.Execute (System.String[] args, SonarQube.Common.ILogger logger) [0x000dd] in <76e5086a486b4c68925b0809607fa8c1>:0
  at SonarQube.Bootstrapper.Program.Main (System.String[] args) [0x00021] in <76e5086a486b4c68925b0809607fa8c1>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.ComponentModel.Win32Exception (0x80004005): ApplicationName='/Users/magic/Documents/Projects/services/sonar-scanner-msbuild/sonar-scanner-3.0.3.778/bin/sonar-scanner', CommandLine='"-Dsonar.login=admin" "-Dsonar.scanAllFiles=true" "-Dsonar.password=xxxxxx" "-Dproject.settings=/Users/magic/Documents/Projects/c#/ConsoleApp1/.sonarqube/out/sonar-project.properties"', CurrentDirectory='/Users/magic/Documents/Projects/c#/ConsoleApp1', Native error= Access denied
  at System.Diagnostics.Process.StartWithCreateProcess (System.Diagnostics.ProcessStartInfo startInfo) [0x002dc] in <04fdc8acaa5e466bb267a3960bdb1f37>:0
  at System.Diagnostics.Process.Start () [0x0003a] in <04fdc8acaa5e466bb267a3960bdb1f37>:0
  at (wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start()
  at SonarQube.Common.ProcessRunner.Execute (SonarQube.Common.ProcessRunnerArguments runnerArgs) [0x000df] in <184f94cfa81445e38fb1a98c6eca5c13>:0
  at SonarScanner.Shim.SonarScannerWrapper.ExecuteJavaRunner (SonarQube.Common.AnalysisConfig config, System.Collections.Generic.IEnumerable`1[T] userCmdLineArguments, SonarQube.Common.ILogger logger, System.String exeFileName, System.String propertiesFileName) [0x00053] in <40209c7fedb345b0bc4e48d7b04dc4cc>:0
  at SonarScanner.Shim.SonarScannerWrapper.InternalExecute (SonarQube.Common.AnalysisConfig config, System.Collections.Generic.IEnumerable`1[T] userCmdLineArguments, SonarQube.Common.ILogger logger, System.String fullPropertiesFilePath) [0x0001b] in <40209c7fedb345b0bc4e48d7b04dc4cc>:0
  at SonarScanner.Shim.SonarScannerWrapper+<>c__DisplayClass6_0.<Execute>b__0 () [0x0003a] in <40209c7fedb345b0bc4e48d7b04dc4cc>:0
  at SonarScanner.Shim.SonarProjectPropertiesValidator.Validate (System.String sonarScannerCwd, System.Collections.Generic.ICollection`1[T] projects, System.Action onValid, System.Action`1[T] onInvalid) [0x00082] in <40209c7fedb345b0bc4e48d7b04dc4cc>:0
  at SonarScanner.Shim.SonarScannerWrapper.Execute (SonarQube.Common.AnalysisConfig config, System.Collections.Generic.IEnumerable`1[T] userCmdLineArguments, SonarQube.Common.ILogger logger) [0x00092] in <40209c7fedb345b0bc4e48d7b04dc4cc>:0
  at SonarQube.TeamBuild.PostProcessor.MSBuildPostProcessor.InvokeSonarScanner (SonarQube.Common.IAnalysisPropertyProvider cmdLineArgs, SonarQube.Common.AnalysisConfig config) [0x00013] in <c02c645a99c24060a2edd0cf9161959e>:0
  at SonarQube.TeamBuild.PostProcessor.MSBuildPostProcessor.Execute (System.String[] args, SonarQube.Common.AnalysisConfig config, SonarQube.TeamBuild.Integration.Interfaces.ITeamBuildSettings settings) [0x000c3] in <c02c645a99c24060a2edd0cf9161959e>:0
  at SonarQube.Bootstrapper.BootstrapperClass.PostProcess () [0x00080] in <76e5086a486b4c68925b0809607fa8c1>:0
  at SonarQube.Bootstrapper.BootstrapperClass.Execute () [0x00041] in <76e5086a486b4c68925b0809607fa8c1>:0
  at SonarQube.Bootstrapper.Program.Execute (System.String[] args, SonarQube.Common.ILogger logger) [0x000dd] in <76e5086a486b4c68925b0809607fa8c1>:0
  at SonarQube.Bootstrapper.Program.Main (System.String[] args) [0x00021] in <76e5086a486b4c68925b0809607fa8c1>:0

Does anyone know how to fix the issue? Thank you very much.

like image 546
WeiHan Hung Avatar asked Feb 04 '18 07:02

WeiHan Hung


1 Answers

Try running:

chmod +x /Users/magic/Documents/Projects/services/sonar-scanner-msbuild/sonar-scanner-3.0.3.778/bin/sonar-scanner
like image 93
Nathanial Woolls Avatar answered Sep 22 '22 11:09

Nathanial Woolls