How Do You Browse SonarQube and Interact with It as a Web UI from the Front-End?

Problem scenario
You run a “sudo ps -ef | grep sonar” and find Sonar to be running.  You run “sudo sytemctl status sonar” and find that it is active.  You run nmap or netstat and see port activity from the sonar service.  Sonar is listening.  When you go to a web browser over the right port (e.g., http://x.x.x.x:9000/) you do not see any web page.  There is no evidence you can connect. 

How Do You Troubleshoot Sonarqube Not Starting with Log Messages about “failed to load plugin”?

Problem scenario
You are using SonarQube Community Edition.  SonarQube will not start.  You recently moved a .jar file into a plugins directory.  You want to use this plugin to analyze code.  

The SonarQube logs may register something like “Background initialization failed. Stopping SonarQube java.lang.IllegalStateException: Fail to load plugin C / C++ / Objective-C [cpp]”

The logs may also say something like this: “Unable to register extension com.A.A.A.B.F from plugin ‘cpp’ or “NoClassFoundError…PropertiesDao”.

How Do You Troubleshoot the Sonar-Scanner Problem “java.lang.IllegalStateException: Unable to load component class org.sonar.scanner.scan.ProjectLock”?

Problem scenario
You run sonar-scanner from the command line.  You receive an error such as this:  “Error during SonarQube Scanner execution … java.lang.IllegalStateException: Unable to load component class org.sonar.scanner.scan.ProjectLock at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java.64”

What should you do?

Possible solution #1
Is the sonar-project.properties file in the directory from which you ran sonar-scanner?  This command expects this file to be in that directory.

How Do You Troubleshoot the SonarQube Problem “Service unavailable” in the Web UI?

Problem scenarios
Your situation is described in one of two ways.

#1  You go to the SonarQube web UI to log in.  You see nowhere to log in.  You see this error: “Service Unavailable    The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.”  What should you do?

Or your situation is like this:

#2 

How Do You Install SonarQube Scanner on a RHEL Server?

Update on 2/10/22: The Python example is a little dated. Back when Python 2.x was common, the print statements didn’t necessarily have parentheses.

Problem scenario
SonarQube does not work without a launcher installed.  The web UI seems complete, but it is not.  You need a CLI launcher of some sort on the back-end.  You want to use sonar-scanner from the command prompt to analyze some code. 

How Do You Get the Sonar Scanner Tool to Be Reinstalled on a Jenkins Slave?

Problem scenario
You want to uninstall the Sonar Scanner CLI to force its reinstallation as you have a Jenkins job that does the installation automatically.  What do you do to uninstall it and make the Jenkins job do the installation again?

Solution
1.  For the Sonar Scanner job that will run, configure it so it runs on a specific slave.  Log into Jenkins.  Go to the Jenkins job,

How Do You Find the Version of SonarQube That You Have Installed?

Problem scenario
You have installed SonarQube.  You want to know what version you are using.  How do you find out?

Solution
Go to the web UI for SonarQube.  It may be as simple as opening a web browser and entering the external IP address of the server.  Without logging in scroll to the bottom.  You should see something like this near the bottom:  Version 6.7 (build 33306)

How Do You Change the Base URL for SonarQube?

Problem scenario
Currently you have to enter a URL like this to access SonarQube’s web UI:

http://servername.com:9000/sonar

You want to be able to type no path (e.g., no “sonar”) in the web browser.  You want to just enter the hostname in the web browser and the port number of the SonarQube server.  What should you do?

Solution
Go to the conf directory [that is a sibling] with the sonar.properties file. 

How Do You Troubleshoot the SonarQube Problem with Nothing Displaying in the Web Browser?

Problem scenario
You go to the SonarQube web UI to log in.  You see nowhere to log in but no error either.  What could be wrong?

Solution
Have your web browser accept cookies.  If you block cookies and using Apache web server with SonarQube 7.x, you may experience this problem.

What is the Sonar Scanner?

Question
You have read about the Sonar Scanner.  What is it exactly?

Answer
It is now called the SonarQube Scanner — not the Sonar Scanner.  Source: https://docs.sonarqube.org/latest/

“The SonarQube Scanner is recommended as the default launcher to analyze a project with SonarQube.”  This quote was taken from
https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner.