lukisp
lukisp

Reputation: 1081

SonarQube local - cannot upload report

I have installed Sonar with its default database and Java plugin, and run with administration mode using StartSonar.bat for x64 systems. On the project I have tried to execute:

sonar:sonar -Dsonar.host.url=http://127.0.0.1:9000/sonar \
    -Dsonar.login=8ce27c4f2845054c89899eaddcfc650276afbb1f -e -X

But with this I'm getting a timeout while uploading the report to the server. It looks like there is some problem with a POST command:

Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.3.0.603:sonar (default-cli) on project pcnttc: Fail to request http://127.0.0.1:9000/sonar/api/ce/submit?projectKey=pl.ttc.web.pcnttc:pcnttc&projectName=PCNttc%20Service: timeout -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.3.0.603:sonar (default-cli) on project pcnttc: Fail to request http://127.0.0.1:9000/sonar/api/ce/submit?projectKey=pl.ttc.web.pcnttc:pcnttc&projectName=PCNttc%20Service
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
Caused by: org.apache.maven.plugin.MojoExecutionException: Fail to request http://127.0.0.1:9000/sonar/api/ce/submit?projectKey=pl.ttc.web.pcnttc:pcnttc&projectName=PCNttc%20Service
    at org.sonarsource.scanner.maven.bootstrap.ExceptionHandling.handle(ExceptionHandling.java:36)
    at org.sonarsource.scanner.maven.bootstrap.ScannerBootstrapper.execute(ScannerBootstrapper.java:80)
    at org.sonarsource.scanner.maven.SonarQubeMojo.execute(SonarQubeMojo.java:139)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
    ... 21 more
Caused by: java.lang.IllegalStateException: Fail to request http://127.0.0.1:9000/sonar/api/ce/submit?projectKey=pl.ttc.web.pcnttc:pcnttc&projectName=PCNttc%20Service
    at org.sonarqube.ws.client.HttpConnector.doCall(HttpConnector.java:176)
    at org.sonarqube.ws.client.HttpConnector.post(HttpConnector.java:143)
    at org.sonarqube.ws.client.HttpConnector.call(HttpConnector.java:102)
    at org.sonar.scanner.bootstrap.ScannerWsClient.call(ScannerWsClient.java:73)
    at org.sonar.scanner.report.ReportPublisher.upload(ReportPublisher.java:182)
    at org.sonar.scanner.report.ReportPublisher.execute(ReportPublisher.java:134)
    at org.sonar.scanner.phases.PublishPhaseExecutor.publishReportJob(PublishPhaseExecutor.java:72)
    at org.sonar.scanner.phases.PublishPhaseExecutor.executeOnRoot(PublishPhaseExecutor.java:54)
    at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:83)
    at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:179)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:144)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:129)
    at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:261)
    at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:256)
    at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:245)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:144)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:129)
    at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:47)
    at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:84)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:144)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:129)
    at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:119)
    at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:116)
    at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:63)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
    at com.sun.proxy.$Proxy23.execute(Unknown Source)
    at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:233)
    at org.sonarsource.scanner.api.EmbeddedScanner.runAnalysis(EmbeddedScanner.java:151)
    at org.sonarsource.scanner.maven.bootstrap.ScannerBootstrapper.execute(ScannerBootstrapper.java:77)
    ... 24 more
Caused by: java.net.SocketTimeoutException: timeout
    at okio.Okio$4.newTimeoutException(Okio.java:227)
    at okio.AsyncTimeout.exit(AsyncTimeout.java:274)
    at okio.AsyncTimeout$1.write(AsyncTimeout.java:185)
    at okio.RealBufferedSink.emitCompleteSegments(RealBufferedSink.java:171)
    at okio.RealBufferedSink.write(RealBufferedSink.java:41)
    at okhttp3.internal.http1.Http1Codec$FixedLengthSink.write(Http1Codec.java:286)
    at okio.RealBufferedSink.emitCompleteSegments(RealBufferedSink.java:171)
    at okio.RealBufferedSink.writeAll(RealBufferedSink.java:99)
    at okhttp3.RequestBody$3.writeTo(RequestBody.java:118)
    at okhttp3.MultipartBody.writeOrCountBytes(MultipartBody.java:171)
    at okhttp3.MultipartBody.writeTo(MultipartBody.java:113)
    at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:62)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
    at org.sonarqube.ws.client.OkHttpClientBuilder.addUserAgent(OkHttpClientBuilder.java:195)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
    at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
    at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:120)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
    at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:185)
    at okhttp3.RealCall.execute(RealCall.java:69)
    at org.sonarqube.ws.client.HttpConnector.doCall(HttpConnector.java:173)
    ... 56 more

I'm doing it on Windows on my local laptop. I'm also able to login to Sonar GUI (there I generate tokens for login). I have tried to search for some solution, but cannot find any working for me, any ideas ?

More info about issue:

My configuration:

project build with:

sonar:sonar -Dsonar.host.url=http://127.0.0.1:9000/sonar -Dsonar.login=de9a75c2b282cb759a9893dd8ad3ef479bef245f -Dsonar.jdbc.url=jdbc:postgresql://localhost:5432/sonarqube -Dsonar.jdbc.username=postgres -Dsonar.jdbc.password=postgres -X -e

I have search multiple places for solution of this issue. I have also download example project from sonar to run analyze on it. On example project one on few analyze return successful, and see analyze details on web interface - between them (analyzes) - nothing changed in my network/local configuration.

  1. sonar.host.url - has proper value, I have also tried with localhost and 127.0.0.1
  2. I give sonar data to full access account on PostgreSQL
  3. database I have installed only for postgres
  4. there is only one analyze at time (manual triggered)
  5. I have installed newest version
  6. sonar.ws.timeout=1800

Upvotes: 4

Views: 5481

Answers (1)

dokaspar
dokaspar

Reputation: 8644

There are quite a few related questions about timeouts happening during a Sonar analysis, have you had a look at them? Here are some candidates:

A wide variety of solutions are suggested in them, for example:

  • are you sure the sonar.host.url in the sonar properties file is set correctly (e.g., use the IP address instead of localhost)?
  • maybe the default port 9000 is already in use by another application?
  • are you using the correct user/password for the sonar database?
  • are you sure the database is responsive/reachable (for example, not blocked due to a database backup)?
  • if the timeout may be caused by too much load, then add more resources to SonarQube server process and/or server platform (e.g. faster disks)
  • upgrade the SonarQube server to the newest version
  • increase the default timeout values (e.g., sonar.ws.timeout)

Upvotes: 1

Related Questions