Arrived the error while running "sonar-scanner"

I have activated the trial license key yesterday and try to run “sonar-scanner” on my Linux machine (Ubuntu 18.04 LTS) but I have got following error:

ERROR: Error during SonarQube Scanner execution
ERROR: Not authorized. Please check the properties sonar.login and sonar.password.
ERROR:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.

I tried to for technical support but still not received any response. Can you please help me in that case? or align me to some of the technical guy so I can coordinate with him, it would be really great help.

Hey there. As the logs suggest, you need to pass -Dsonar.login=username -Dsonar.password=password (replacing the username and password values with appropriate values) to the sonar-scanner command.

A token (generated in the SQ UI) passed to -Dsonar.login will also do.

The user in question will also need to have Execute Analysis permissions.

Thank you brother for your post. but when I run as you suggest it produces different following new error:

ERROR:

The only way to get an accurate analysis of C/C++/Objective-C files is by using the SonarSource build-wrapper
and setting the property “sonar.cfamily.build-wrapper-output”, but it was not specified.

If you don’t want to analyze C/C++/Objective-C files, then prevent them from being analyzed by setting the following properties:

sonar.c.file.suffixes=-
sonar.cpp.file.suffixes=-
sonar.objc.file.suffixes=-

INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 28.691s
INFO: Final Memory: 73M/1225M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR:

The only way to get an accurate analysis of C/C++/Objective-C files is by using the SonarSource build-wrapper
and setting the property “sonar.cfamily.build-wrapper-output”, but it was not specified.

If you don’t want to analyze C/C++/Objective-C files, then prevent them from being analyzed by setting the following properties: I also have attached screenshot

sonar.c.file.suffixes=-
sonar.cpp.file.suffixes=-
sonar.objc.file.suffixes=-

ERROR:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.

What does the error tell you? :slight_smile: Are you trying to analyze C/C++ files?

If you are, there’s a great tutorial in the UI when you create a project, and further documentation on Analyazing C/C++ code

ERROR:

The only way to get an accurate analysis of C/C++/Objective-C files is by using the SonarSource build-wrapper
and setting the property “sonar.cfamily.build-wrapper-output”, but it was not specified.

If you don’t want to analyze C/C++/Objective-C files, then prevent them from being analyzed by setting the following properties:

sonar.c.file.suffixes=-
sonar.cpp.file.suffixes=-
sonar.objc.file.suffixes=-

INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 31.224s
INFO: Final Memory: 66M/800M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR:

The only way to get an accurate analysis of C/C++/Objective-C files is by using the SonarSource build-wrapper
and setting the property “sonar.cfamily.build-wrapper-output”, but it was not specified.

If you don’t want to analyze C/C++/Objective-C files, then prevent them from being analyzed by setting the following properties:

sonar.c.file.suffixes=-
sonar.cpp.file.suffixes=-
sonar.objc.file.suffixes=-

ERROR:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.

I can not understand the error even I have added files in exclusion on Sonarqube portal.

How did you configure them? Do you have the logs available from after you configured the exclusions?

For example:

INFO: Project configuration:
INFO:   Excluded sources: **/*.c
INFO: 5 files indexed

lasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch
2021.04.17 08:37:48 INFO app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
warning: no-jdk distributions that do not bundle a JDK are deprecated and will be removed in a future release
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
2021.04.17 08:37:56 INFO app[o.s.a.SchedulerImpl] Process[es] is up

Using sonarqube developer edition 8.7…it was working before but suddenly stoppped elasticsearch with no reason…I am using Ubuntu 18.04 LTS. Please help!

← Wrapper Stopped
→ Wrapper Started as Daemon
Launching a JVM…
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved.

2021.04.17 08:37:48 INFO app[o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp
2021.04.17 08:37:48 INFO app[o.s.a.es.EsSettings] Elasticsearch listening on [HTTP: 127.0.0.1:9001, TCP: 127.0.0.1:42433]
2021.04.17 08:37:48 INFO app[o.s.a.ProcessLauncherImpl] Launch process[[key=‘es’, ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch
2021.04.17 08:37:48 INFO app[o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
warning: no-jdk distributions that do not bundle a JDK are deprecated and will be removed in a future release
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
2021.04.17 08:37:56 INFO app[o.s.a.SchedulerImpl] Process[es] is up
2021.04.17 08:37:56 INFO app[o.s.a.ProcessLauncherImpl] Launch process[[key=‘web’, ipcIndex=2, logFilenamePrefix=web]] from [/opt/sonarqube]: /usr/lib/jvm/java-11-openjdk-amd64/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/opt/sonarqube/temp -XX:-OmitStackTraceInFastThrow --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Dhttp.nonProxyHosts=localhost|127.|[::1] -cp ./lib/common/:/opt/sonarqube/lib/jdbc/postgresql/postgresql-42.2.17.jar org.sonar.server.app.WebServer /opt/sonarqube/temp/sq-process17746132108612749812properties
2021.04.17 08:38:18 INFO app[o.s.a.SchedulerImpl] Process[web] is up
2021.04.17 08:38:18 INFO app[o.s.a.ProcessLauncherImpl] Launch process[[key=‘ce’, ipcIndex=3, logFilenamePrefix=ce]] from [/opt/sonarqube]: /usr/lib/jvm/java-11-openjdk-amd64/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/opt/sonarqube/temp -XX:-OmitStackTraceInFastThrow --add-opens=java.base/java.util=ALL-UNNAMED -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Dhttp.nonProxyHosts=localhost|127.|[::1] -cp ./lib/common/:/opt/sonarqube/lib/jdbc/postgresql/postgresql-42.2.17.jar org.sonar.ce.app.CeServer /opt/sonarqube/temp/sq-process8410296179395299141properties
2021.04.17 08:38:22 INFO app[o.s.a.SchedulerImpl] Process[ce] is up
2021.04.17 08:38:22 INFO app[o.s.a.SchedulerImpl] SonarQube is up

Please feel free to raise a new thread if you still face an issue with SonarQube staying up (from the logs you shared, it looks like it’s all running fine). This thread should stick to the original topic.