2
votes

I get the following error when I try to execute SonarQube Scanner as a part of Jenkins build:

ERROR: SonarQube server [http://<hostname>:9000] can not be reached

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

INFO: EXECUTION FAILURE

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

INFO: Total time: 0.242s

INFO: Final Memory: 5M/483M

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

ERROR: Error during SonarQube Scanner execution

org.sonarsource.scanner.api.internal.ScannerException: Unable to execute SonarQube

at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:84)

at 
... 8 more

Caused by: java.lang.IllegalStateException: Status returned by
 url [http://<hostname>:9000/batch/index] is not valid: [404]

at org.sonarsource.scanner.api.internal.ServerConnection.callUrl(ServerConnection.java:115)

at org.sonarsource.scanner.api.internal.Jars.getBootstrapIndex(Jars.java:96)

... 12 more

ERROR: 

I can access the following URL from my Jenkins host: http://:9000/sonar/ . When I try to execute this:

wget http://<hostname>:9000/batch/index

I get the same 404 http error in response. I have no idea from where this URL postfix /batch/index comes from. Web search did not give any clues for this.

My Sonar version is 6.0. My Jenkins Sonar Scanner plugin version is 2.6.1.

Used JVM:

java version "1.8.0_121" Java(TM) SE Runtime Environment (build 1.8.0_121-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)

1

1 Answers

2
votes

What is your the setting for sonar's web context (sonar.web.context) on your sonar server? It would be inside of sonar.properties. By default both the Jenkins plugin and the sonar server configuration set it to root:

'http://<hostname>:9000/'

The first thing I would do is to make sure those are matching in the sonar configuration and the jenkins plugin configuration.

I've seen tutorials that tell you to use /sonar or something similar. In that case, the jenkins plugin would need to be set to /sonar as well, like:

'http://<hostname>:9000/sonar'