SonarQube – Web server startup failedjava.lang. IllegalStateException: Fail to connect to database
September 4, 2023 2023-09-09 8:42SonarQube – Web server startup failedjava.lang. IllegalStateException: Fail to connect to database
SonarQube – Web server startup failedjava.lang. IllegalStateException: Fail to connect to database
While I’m trying to build and run the SonarQube and Postges in docker containers, the sonarQube couldn’t start and run the container, when looked at the logs output using the command below,
docker container logs sonarqube
2023.08.16 18:37:14 ERROR web[][o.s.s.p.PlatformImpl] Web server startup failed
java.lang.IllegalStateException: Fail to connect to database
After analysed the above error, the SonarQube required the database from the postgresql so need to create a new database name in Postgres:
login to the postgresql docker container and create a new database,
docker container exec -it postgresql bash
the command to enter into the “postgres: psql -U sonar” then create a new database, “CREATE DATABASE sonarqube;”
root@935985532e0d:/# psql -U sonar
psql (12.16 (Debian 12.16-1.pgdg110+1))
Type "help" for help.
sonar=# CREATE DATABASE sonarqube;
once created a new database in postgres then start the sonarqube docker container.