Read timed out when running Sonarscanner using Jenkins

Asked

Viewed 45 times

1

During the execution of an analysis of the Sonarscanner integrated into the Jenkins, the following message is required on console output:

INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 3:33.658s
INFO: Final Memory: 5M/24M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR: Unable to load component class org.sonar.scanner.scan.ProjectConfiguration
ERROR: Caused by: Unable to load component class org.sonar.scanner.scan.ProjectServerSettings
ERROR: Caused by: Fail to request http://sonarqube:9000/sonarqube/api/settings/values.protobuf?component=AplicacaoTeste
ERROR: Caused by: timeout
ERROR: Caused by: Read timed out

OBS: I’m using Docker Containers for both Jenkins and SonarQube.

Customized sonar values.properties:

sonar.jdbc.username=YYYY
sonar.jdbc.password=XXXX
sonar.jdbc.url=jdbc:postgresql://sonarqube_db:5432/YYYY
sonar.jdbc.maxActive=1000
sonar.jdbc.maxIdle=8
sonar.jdbc.minIdle=4
sonar.jdbc.maxWait=0
sonar.web.host=0.0.0.0
sonar.web.context=/sonarqube
sonar.web.port=9000

Versions:
Sonarqube: 7.9.1
Sonarscanner Jenkins Plugin: 2.6.1
Jenkins: lts-jdk11
Docker Windows Desktop: 2

What would be the reason for the mistake?

1 answer

0

Whoa, that’s all right ?

About the containers, are they in the same 'network' ? See the example of Docker-Compose below:

version: "3"
networks:
  stack:
    driver: bridge

volumes:
  jenkins_data: {}
  sonarqube_conf: {}
  sonarqube_data: {}
  sonarqube_extensions: {}
  sonarqube_bundled-plugins: {}
  postgresql: {}
  postgresql_data: {}

services:

  sonar:
    image: sonarqube:7.9.1
    container_name: sonarqube
    ports:
      - 9000:9000
      - 9092:9092
    environment:
      - SONARQUBE_JDBC_URL=jdbc:postgresql://sonarqube_db:5432/sonar
      - SONARQUBE_JDBC_USERNAME=sonar
      - SONARQUBE_JDBC_PASSWORD=sonar
      - SONARQUBE_WEB_CONTEXT=/sonarqube
    volumes:
      - sonarqube_conf:/opt/sonarqube/conf
      - sonarqube_data:/opt/sonarqube/data
      - sonarqube_extensions:/opt/sonarqube/extensions
      - sonarqube_bundled-plugins:/opt/sonarqube/lib/bundled-plugins
    networks:
      - stack

  db:
    image: postgres
    container_name: sonarqube_db
    ports:
      - 5432
    environment:
      - POSTGRES_USER=sonar
      - POSTGRES_PASSWORD=sonar
    volumes:
      - postgresql:/var/lib/postgresql
      - postgresql_data:/var/lib/postgresql/data
    networks:
      - stack

  jenkins:
    image: jenkins/jenkins:lts
    container_name: jenkins
    ports:
      - 8080:8080
      - 50000:50000
    volumes:
     - jenkinsdata:/var/jenkins_home
     - /var/run/docker.sock:/var/run/docker.sock
    networks:
      - stack

Another thing to know is whether the sonar-project.properties file was created, in the project to be scanned. Example:

sonar.sources=src/main/java
sonar.tests=src/test/java
sonar.java.binaries=target/classes
sonar.java.test.binaries=target/test-classes
sonar.junit.reportPaths=target/surefire-reports
sonar.jacoco.reportPaths=target/jacoco.exec
sonar.sourceEncoding=UTF-8

Browser other questions tagged

You are not signed in. Login or sign up in order to post.