SonarQube Error During Runner Execution

3.6k views Asked by At

I am new to SonarQube and was having a connection timed out error preventing sonar-runner from publishing a small application to sonarqube.

Versions:

  • SonarQube Runner 2.4
  • Java 1.7.0_45 Oracle Corporation (64-bit)
  • Linux 3.5.0-42-generic amd64

The confusing part is that this works fine when executing sonar-runner on the windows machine hosting sonarqube. I have changed the port default port from 9000 and tested both connections for validity. That has not resolved the issue.

Only when attempting to run sonar-runner manually from the command line on the virtual machine storing the source code does and error occur. I have also increased the allowable memory in the heap size via the SONAR_RUNNER_OPTS in the sonar-runner.bat file.

Please advise or let me know what additional information is needed.

INFO: Error stacktraces are turned on. 
INFO: Runner configuration file: /opt/sonar-runner/sonar-runner-2.4/conf/sonar-runner.properties 
INFO: Project configuration file: /var/lib/svn/repos/secureci/secureciDemoRepo/LaserGem_Sample/sonar-project.properties 
INFO: Default locale: "en_US", source code encoding: "UTF-8" 
INFO: Work directory: /var/lib/svn/repos/secureci/secureciDemoRepo/LaserGem_Sample/./.sonar 
INFO: ------------------------------------------------------------------------ 
INFO: EXECUTION FAILURE 
INFO: ------------------------------------------------------------------------ 
Total time: 30.047s Final Memory: 0M/30M 
INFO: ------------------------------------------------------------------------ 
ERROR: Error during Sonar runner execution org.sonar.runner.kevinsawicki.HttpRequest$HttpRequestException: java.net.SocketTimeoutException: connect timed out
 at org.sonar.runner.kevinsawicki.HttpRequest.code(HttpRequest.java:1392)
 at org.sonar.runner.kevinsawicki.HttpRequest.ok(HttpRequest.java:1417)
 at org.sonar.runner.impl.ServerConnection.downloadString(ServerConnection.java:93)
 at org.sonar.runner.impl.ServerVersion.downloadVersion(ServerVersion.java:47)
 at org.sonar.runner.impl.ServerVersion.version(ServerVersion.java:38)
 at org.sonar.runner.impl.ServerVersion.is37Compatible(ServerVersion.java:58)
 at org.sonar.runner.impl.JarDownloader.checkVersionAndDownload(JarDownloader.java:36)
 at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:71)
 at java.security.AccessController.doPrivileged(Native Method)
 at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
 at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
 at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
 at org.sonar.runner.api.Runner.execute(Runner.java:100)
 at org.sonar.runner.Main.executeTask(Main.java:70)
 at org.sonar.runner.Main.execute(Main.java:59)
 at org.sonar.runner.Main.main(Main.java:53) Caused by: java.net.SocketTimeoutException: connect timed out
 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
 at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1675)
 at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1673)
 at java.security.AccessController.doPrivileged(Native Method)
 at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1671)
 at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1244)
 at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468)
 at org.sonar.runner.kevinsawicki.HttpRequest.code(HttpRequest.java:1390) ... 15 more Caused by: java.net.SocketTimeoutException: connect timed out
 at java.net.PlainSocketImpl.socketConnect(Native Method)
 at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
 at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
 at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
 at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
 at java.net.Socket.connect(Socket.java:579)
 at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
 at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
 at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
 at sun.net.www.http.HttpClient.<init>(HttpClient.java:211)
 at sun.net.www.http.HttpClient.New(HttpClient.java:308)
 at sun.net.www.http.HttpClient.New(HttpClient.java:326)
 at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:996)
 at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:932)
 at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:850)
 at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1300)
 at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(HttpURLConnection.java:2678)
 at org.sonar.runner.kevinsawicki.HttpRequest.header(HttpRequest.java:1903)
 at org.sonar.runner.kevinsawicki.HttpRequest.contentType(HttpRequest.java:2308)
 at org.sonar.runner.impl.ServerConnection.downloadString(ServerConnection.java:89) ... 13 more
1

There are 1 answers

1
Fabrice - SonarSource Team On

This looks like your Linux server on which you try to run the SonarQube analysis cannot reach the Windows server on which the SonarQube server runs. You might have some firewall or network settings that prevents this communication.