Manual Installation of SonarQube with Jenkins in server with no connection to internet (Error code 126?)


(KoishiChan) #1

Hi there,

I’m trying to get SonarQube to run on my server as a Jenkins plugin. My server is running on Oracle Solaris 11.1 SPARC.

The Sonar Scanner version I’ve installed is sonar-scanner-3.3.0.1492-linux.

After changing file permissions and configuring Jenkins to run Sonar Scanner executable, currently when I try to build the project, in the console output, I currently get the following message:

[-Trunk] $ //sonar-scanner-3.3.0.1492-linux/bin/sonar-scanner -X -Dsonar.host.url= -Dsonar.projectBaseDir=//sonar-scanner-3.3.0.1492-linux/bin/sonar-scanner[59]: exec: //sonar-scanner-3.3.0.1492-linux/jre/bin/java: cannot execute [Invalid argument]
WARN: Unable to locate ‘report-task.txt’ in the workspace. Did the SonarScanner succedeed?
ERROR: SonarQube scanner exited with non-zero code: 126
Finished: FAILURE

I can’t find any information on the error code 126, and there doesn’t seem to be much information about installing SonarQube on a non internet-connected server.


(G Ann Campbell) #2

Hi,

It’s difficult to know without more details just what’s going on, but I find these parts highly suspicious:

-Dsonar.host.url=
You seem to have overridden the default host url

(http://localhost:9000) with… nothing?

-Dsonar.projectBaseDir=//sonar-scanner-3.3.0.1492-linux/bin/sonar-scanner[59]:

Setting projectBaseDir at all is suspicious in itself; you should execute analysis from the projectBaseDir and then not need to set it. The fact that you appear to have set this value to… the location of your scanner executable is just wrong.

You need to put sonar-scanner in your $PATH, then cd into your project root and execute it. Typically your project settings will be in a file named sonar-project.properties in your project root, or if not there, then passed on the command line. At a minimum you need to provide the location of your SonarQube server (sonar.host.url), your project key (sonar.projectKey) and the location of your source files (sonar.sources). A few more will be required if this is a Java project, but for most other languages this is enough to get you going.

 
Ann


(KoishiChan) #3

Hi Ann,

Thanks for your response!

Regarding default host URL, I am trying to use sonar scanner on jenkins, so would this setting be under Manage Jenkins -> Configure System -> SonarQube servers -> Server URL? Because currently that is configured to the IP of the server. Should I be setting it back to default?

Also, the reason its pointing to the scanner is because initially I received this error:
FATAL: SonarQube Scanner executable was not found for SonarQube Scanner

To be honest I have no idea of any of the settings required for this. The project I’m trying to install this on is an almost decade old project running on Struts 1. Do I need to create a separate sonarqube server before I can run it on Jenkins? The documentation for SonarQube is not quite clear on this. Most tutorials I’ve seen directly install SonarQube as a plugin on Jenkins, but those tutorials tend to have internet connection and are thus able to configure Sonar Scanner automatically.

Please advise, sorry for the trouble.


(G Ann Campbell) #4

Hi,

In this case you shouldn’t be explicitly setting the value to anything. The SonarQube Scanner for Jenkins docs should help.

In general, what you need is

  1. install SonarQube
  2. install in Jenkins the SonarQube plugin
  3. configure in Jenkins at the global level the location of your SonarQube server, and the location of the scanner you’ll use via Jenkins
  4. configure analysis in your job.

A separate SonarQube instance is neither needed nor desirable.

 
Ann