First installation of Sonarqube 8.4.1-developer doesn't start up correctly

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
  • what are you trying to achieve
  • what have you tried so far to achieve this

Installation : Sonarqube 8.4.1-developer with docker. Image name ‘sonarqube:8.4.1-developer’

I’m trying to install sonarqube following availlable documention on the net (https://docs.sonarqube.org/latest/setup/install-server/) but there is still error during sonarqube startup.

Current status :
Docker image correctly installed and running
Java installed :
Java -version command output :

  • openjdk version “1.8.0_252”
  • OpenJDK Runtime Environment (build 1.8.0_252-8u252-b09-1~16.04-b09)
  • OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode)

Docker run with docker compose with following parameters in file “docker-compose.yml”

version: ‘2’

services:
sonarqube:
image: ‘sonarqube:8.4.1-developer’
container_name: sonarqube

restart: always
environment:
   - SONARQUBE_JDBC_URL=jdbc:postgresql://localhost:5432/sonarqube_DB
   - SONARQUBE_JDBC_USERNAME=sonarqube
   - SONARQUBE_JDBC_PASSWORD=sonarqube

volumes:
- '/srv/sonarqube/sonarqube_logs:/opt/sonarqube/logs'
- '/srv/sonarqube/sonarqube_data:/opt/sonarqube/data'
- '/srv/sonarqube/sonarqube_extensions:/opt/sonarqube/extensions'


ports:
 - 9000:9000

sonar.log error extraction :

2020.09.07 10:33:07 INFO app[o.e.p.PluginsService] no modules loaded
2020.09.07 10:33:07 INFO app[o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
2020.09.07 10:33:17 INFO app[o.s.a.SchedulerImpl] Process[es] is up
2020.09.07 10:33:17 INFO app[o.s.a.ProcessLauncherImpl] Launch process[[key=‘web’, ipcIndex=2, logFilenamePrefix=web]] from [/opt/sonarqube]: /opt/java/openjdk/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/opt/sonarqube/temp -XX:-OmitStackTraceInFastThrow --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Dhttp.nonProxyHosts=localhost|127.|[::1] -cp ./lib/common/:/opt/sonarqube/lib/jdbc/postgresql/postgresql-42.2.14.jar org.sonar.server.app.WebServer /opt/sonarqube/temp/sq-process4208426146716634133properties
2020.09.07 10:33:22 INFO app[o.s.a.SchedulerImpl] Process[web] is stopped
2020.09.07 10:33:22 INFO app[o.s.a.SchedulerImpl] Process[es] is stopped
2020.09.07 10:33:22 INFO app[o.s.a.SchedulerImpl] SonarQube is stopped
2020.09.07 10:33:22 WARN app[o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 143
2020.09.07 10:33:23 INFO app[o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp
2020.09.07 10:33:24 INFO app[o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
2020.09.07 10:33:24 INFO app[o.s.a.ProcessLauncherImpl] Launch process[[key=‘es’, ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch
2020.09.07 10:33:24 INFO app[o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2020.09.07 10:33:24 INFO app[o.e.p.PluginsService] no modules loaded
2020.09.07 10:33:24 INFO app[o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
2020.09.07 10:33:34 INFO app[o.s.a.SchedulerImpl] Process[es] is up
2020.09.07 10:33:34 INFO app[o.s.a.ProcessLauncherImpl] Launch process[[key=‘web’, ipcIndex=2, logFilenamePrefix=web]] from [/opt/sonarqube]: /opt/java/openjdk/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/opt/sonarqube/temp -XX:-OmitStackTraceInFastThrow --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Dhttp.nonProxyHosts=localhost|127.|[::1] -cp ./lib/common/:/opt/sonarqube/lib/jdbc/postgresql/postgresql-42.2.14.jar org.sonar.server.app.WebServer /opt/sonarqube/temp/sq-process3877441288990969220properties
2020.09.07 10:33:38 INFO app[o.s.a.SchedulerImpl] Process[web] is stopped
2020.09.07 10:33:38 INFO app[o.s.a.SchedulerImpl] Process[es] is stopped
2020.09.07 10:33:38 INFO app[o.s.a.SchedulerImpl] SonarQube is stopped
2020.09.07 10:33:38 WARN app[o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 143
2020.09.07 10:33:40 INFO app[o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp
2020.09.07 10:33:40 INFO app[o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
2020.09.07 10:33:40 INFO app[o.s.a.ProcessLauncherImpl] Launch process[[key=‘es’, ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch
2020.09.07 10:33:40 INFO app[o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2020.09.07 10:33:41 INFO app[o.e.p.PluginsService] no modules loaded
2020.09.07 10:33:41 INFO app[o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
2020.09.07 10:33:53 INFO app[o.s.a.SchedulerImpl] Process[es] is up
2020.09.07 10:33:53 INFO app[o.s.a.ProcessLauncherImpl] Launch process[[key=‘web’, ipcIndex=2, logFilenamePrefix=web]] from [/opt/sonarqube]: /opt/java/openjdk/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/opt/sonarqube/temp -XX:-OmitStackTraceInFastThrow --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Dhttp.nonProxyHosts=localhost|127.|[::1] -cp ./lib/common/:/opt/sonarqube/lib/jdbc/postgresql/postgresql-42.2.14.jar org.sonar.server.app.WebServer /opt/sonarqube/temp/sq-process16838855684408714144properties
2020.09.07 10:33:57 INFO app[o.s.a.SchedulerImpl] Process[web] is stopped
2020.09.07 10:33:57 WARN app[o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 143
2020.09.07 10:33:57 INFO app[o.s.a.SchedulerImpl] Process[es] is stopped
2020.09.07 10:33:57 INFO app[o.s.a.SchedulerImpl] SonarQube is stopped
2020.09.07 10:33:59 INFO app[o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp
2020.09.07 10:33:59 INFO app[o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
2020.09.07 10:33:59 INFO app[o.s.a.ProcessLauncherImpl] Launch process[[key=‘es’, ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch
2020.09.07 10:33:59 INFO app[o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2020.09.07 10:33:59 INFO app[o.e.p.PluginsService] no modules loaded
2020.09.07 10:33:59 INFO app[o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]

web.log extraction :

2020.09.07 10:32:59 INFO web[o.s.p.ProcessEntryPoint] Starting web
2020.09.07 10:33:00 INFO web[o.a.t.u.n.NioSelectorPool] Using a shared selector for servlet write/read
2020.09.07 10:33:01 INFO web[o.s.c.e.CoreExtensionsLoader] Loaded core extensions: developer-edition, developer-scanner, developer-server, license
2020.09.07 10:33:02 INFO web[o.e.p.PluginsService] no modules loaded
2020.09.07 10:33:02 INFO web[o.e.p.PluginsService] loaded plugin [org.elasticsearch.join.ParentJoinPlugin]
2020.09.07 10:33:02 INFO web[o.e.p.PluginsService] loaded plugin [org.elasticsearch.percolator.PercolatorPlugin]
2020.09.07 10:33:02 INFO web[o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
2020.09.07 10:33:04 INFO web[o.s.s.e.EsClientProvider] Connected to local Elasticsearch: [127.0.0.1:9001]
2020.09.07 10:33:04 INFO web[o.s.s.p.LogServerVersion] SonarQube Server / 8.4.1.35646 / 7267e37dda923d9336125657aa6d0878af14af53
2020.09.07 10:33:04 INFO web[o.sonar.db.Database] Create JDBC data source for jdbc:postgresql://localhost:5432/sonarqube_DB
2020.09.07 10:33:04 ERROR web[o.s.s.p.PlatformImpl] Web server startup failed
java.lang.IllegalStateException: Fail to connect to database
at org.sonar.db.DefaultDatabase.start(DefaultDatabase.java:86)
at org.sonar.core.platform.StartableCloseableSafeLifecyleStrategy.start(StartableCloseableSafeLifecyleStrategy.java:40)
at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84)
at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169)
at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132)
at org.picocontainer.behaviors.Stored.start(Stored.java:110)
at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1016)
at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1009)
at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:767)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.server.platform.platformlevel.PlatformLevel.start(PlatformLevel.java:90)
at org.sonar.server.platform.platformlevel.PlatformLevel1.start(PlatformLevel1.java:166)
at org.sonar.server.platform.PlatformImpl.start(PlatformImpl.java:213)
at org.sonar.server.platform.PlatformImpl.startLevel1Container(PlatformImpl.java:172)
at org.sonar.server.platform.PlatformImpl.init(PlatformImpl.java:86)
at org.sonar.server.platform.web.PlatformServletContextListener.contextInitialized(PlatformServletContextListener.java:43)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4689)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5155)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1412)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1402)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalStateException: Can not connect to database. Please check connectivity and settings (see the properties prefixed by ‘sonar.jdbc.’).
at org.sonar.db.DefaultDatabase.checkConnection(DefaultDatabase.java:118)
at org.sonar.db.DefaultDatabase.start(DefaultDatabase.java:83)
… 24 common frames omitted
Caused by: java.sql.SQLException: Cannot create PoolableConnectionFactory (Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.)
at org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:669)
at org.apache.commons.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:544)
at org.apache.commons.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:753)
at org.sonar.db.profiling.NullConnectionInterceptor.getConnection(NullConnectionInterceptor.java:31)
at org.sonar.db.profiling.ProfiledDataSource.getConnection(ProfiledDataSource.java:317)
at org.sonar.db.DefaultDatabase.checkConnection(DefaultDatabase.java:115)
… 25 common frames omitted
Caused by: org.postgresql.util.PSQLException: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:285)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)
at org.postgresql.jdbc.PgConnection.(PgConnection.java:217)
at org.postgresql.Driver.makeConnection(Driver.java:458)
at org.postgresql.Driver.connect(Driver.java:260)
at org.apache.commons.dbcp2.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:55)
at org.apache.commons.dbcp2.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:355)
at org.apache.commons.dbcp2.BasicDataSource.validateConnectionFactory(BasicDataSource.java:115)
at org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:665)
… 30 common frames omitted
Caused by: java.net.ConnectException: Connection refused (Connection refused)
at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
at java.base/java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.base/java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.base/java.net.SocksSocketImpl.connect(Unknown Source)
at java.base/java.net.Socket.connect(Unknown Source)
at org.postgresql.core.PGStream.(PGStream.java:81)
at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:93)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:197)
… 38 common frames omitted
2020.09.07 10:33:04 WARN web[o.a.c.l.WebappClassLoaderBase] The web application [ROOT] appears to have started a thread named [elasticsearch[client][[timer]]] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:\n java.base@11.0.6/java.lang.Thread.sleep(Native Method)\n app//org.elasticsearch.threadpool.ThreadPool$CachedTimeThread.run(ThreadPool.java:574)
2020.09.07 10:33:04 WARN web[o.a.c.l.WebappClassLoaderBase] The web application [ROOT] appears to have started a thread named [elasticsearch[client][scheduler][T#1]] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:\n java.base@11.0.6/jdk.internal.misc.Unsafe.park(Native Method)\n java.base@11.0.6/java.util.concurrent.locks.LockSupport.parkNanos(Unknown Source)\n java.base@11.0.6/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(Unknown Source)\n java.base@11.0.6/java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(Unknown Source)\n java.base@11.0.6/java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(Unknown Source)\n java.base@11.0.6/java.util.concurrent.ThreadPoolExecutor.getTask(Unknown Source)\n java.base@11.0.6/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)\n java.base@11.0.6/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)\n java.base@11.0.6/java.lang.Thread.run(Unknown Source)
2020.09.07 10:33:04 WARN web[o.a.c.l.WebappClassLoaderBase] The web application [ROOT] appears to have started a thread named [elasticsearch[client][transport_worker][T#1]] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:\n java.base@11.0.6/sun.nio.ch.EPoll.wait(Native Method)\n java.base@11.0.6/sun.nio.ch.EPollSelectorImpl.doSelect(Unknown Source)\n java.base@11.0.6/sun.nio.ch.SelectorImpl.lockAndDoSelect(Unknown Source)\n java.base@11.0.6/sun.nio.ch.SelectorImpl.select(Unknown Source)\n app//io.netty.channel.nio.SelectedSelectionKeySetSelector.select(SelectedSelectionKeySetSelector.java:62)\n app//io.netty.channel.nio.NioEventLoop.select(NioEventLoop.java:765)\n app//io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:413)\n app//io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:909)\n java.base@11.0.6/java.lang.Thread.run(Unknown Source)
2020.09.07 10:33:04 WARN web[o.a.c.l.WebappClassLoaderBase] The web application [ROOT] appears to have started a thread named [elasticsearch[client][generic][T#1]] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:\n java.base@11.0.6/jdk.internal.misc.Unsafe.park(Native Method)\n java.base@11.0.6/java.util.concurrent.locks.LockSupport.park(Unknown Source)\n java.base@11.0.6/java.util.concurrent.LinkedTransferQueue.awaitMatch(Unknown Source)\n java.base@11.0.6/java.util.concurrent.LinkedTransferQueue.xfer(Unknown Source)\n java.base@11.0.6/java.util.concurrent.LinkedTransferQueue.take(Unknown Source)\n java.base@11.0.6/java.util.concurrent.ThreadPoolExecutor.getTask(Unknown Source)\n java.base@11.0.6/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)\n java.base@11.0.6/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)\n java.base@11.0.6/java.lang.Thread.run(Unknown Source)
2020.09.07 10:33:04 WARN web[o.a.c.l.WebappClassLoaderBase] The web application [ROOT] appears to have started a thread named [elasticsearch[client][transport_worker][T#2]] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:\n java.base@11.0.6/sun.nio.ch.EPoll.wait(Native Method)\n java.base@11.0.6/sun.nio.ch.EPollSelectorImpl.doSelect(Unknown Source)\n java.base@11.0.6/sun.nio.ch.SelectorImpl.lockAndDoSelect(Unknown Source)\n java.base@11.0.6/sun.nio.ch.SelectorImpl.select(Unknown Source)\n app//io.netty.channel.nio.SelectedSelectionKeySetSelector.select(SelectedSelectionKeySetSelector.java:62)\n app//io.netty.channel.nio.NioEventLoop.select(NioEventLoop.java:765)\n app//io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:413)\n app//io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:909)\n java.base@11.0.6/java.lang.Thread.run(Unknown Source)
2020.09.07 10:33:04 WARN web[o.a.c.l.WebappClassLoaderBase] The web application [ROOT] appears to have started a thread named [elasticsearch[client][transport_worker][T#3]] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:\n java.base@11.0.6/sun.nio.ch.EPoll.wait(Native Method)\n java.base@11.0.6/sun.nio.ch.EPollSelectorImpl.doSelect(Unknown Source)\n java.base@11.0.6/sun.nio.ch.SelectorImpl.lockAndDoSelect(Unknown Source)\n java.base@11.0.6/sun.nio.ch.SelectorImpl.select(Unknown Source)\n app//io.netty.channel.nio.SelectedSelectionKeySetSelector.select(SelectedSelectionKeySetSelector.java:62)\n app//io.netty.channel.nio.NioEventLoop.select(NioEventLoop.java:765)\n app//io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:413)\n app//io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:909)\n java.base@11.0.6/java.lang.Thread.run(Unknown Source)
2020.09.07 10:33:04 WARN web[o.a.c.l.WebappClassLoaderBase] The web application [ROOT] appears to have started a thread named [elasticsearch[client][transport_worker][T#4]] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:\n java.base@11.0.6/sun.nio.ch.EPoll.wait(Native Method)\n java.base@11.0.6/sun.nio.ch.EPollSelectorImpl.doSelect(Unknown Source)\n java.base@11.0.6/sun.nio.ch.SelectorImpl.lockAndDoSelect(Unknown Source)\n java.base@11.0.6/sun.nio.ch.SelectorImpl.select(Unknown Source)\n app//io.netty.channel.nio.SelectedSelectionKeySetSelector.select(SelectedSelectionKeySetSelector.java:62)\n app//io.netty.channel.nio.NioEventLoop.select(NioEventLoop.java:765)\n app//io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:413)\n app//io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:909)\n java.base@11.0.6/java.lang.Thread.run(Unknown Source)
2020.09.07 10:33:04 INFO web[o.s.s.a.EmbeddedTomcat] HTTP connector enabled on port 9000
2020.09.07 10:33:04 INFO web[o.s.p.ProcessEntryPoint] Hard stopping process
2020.09.07 10:33:18 INFO web[o.s.p.ProcessEntryPoint] Starting web
2020.09.07 10:33:18 INFO web[o.a.t.u.n.NioSelectorPool] Using a shared selector for servlet write/read
2020.09.07 10:33:19 INFO web[o.s.c.e.CoreExtensionsLoader] Loaded core extensions: developer-edition, developer-scanner, developer-server, license
2020.09.07 10:33:20 INFO web[o.e.p.PluginsService] no modules loaded
2020.09.07 10:33:20 INFO web[o.e.p.PluginsService] loaded plugin [org.elasticsearch.join.ParentJoinPlugin]
2020.09.07 10:33:20 INFO web[o.e.p.PluginsService] loaded plugin [org.elasticsearch.percolator.PercolatorPlugin]
2020.09.07 10:33:20 INFO web[o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
2020.09.07 10:33:21 INFO web[o.s.s.e.EsClientProvider] Connected to local Elasticsearch: [127.0.0.1:9001]
2020.09.07 10:33:21 INFO web[o.s.s.p.LogServerVersion] SonarQube Server / 8.4.1.35646 / 7267e37dda923d9336125657aa6d0878af14af53
2020.09.07 10:33:21 INFO web[o.sonar.db.Database] Create JDBC data source for jdbc:postgresql://localhost:5432/sonarqube_DB
2020.09.07 10:33:21 ERROR web[o.s.s.p.PlatformImpl] Web server startup failed
java.lang.IllegalStateException: Fail to connect to database
at org.sonar.db.DefaultDatabase.start(DefaultDatabase.java:86)
at org.sonar.core.platform.StartableCloseableSafeLifecyleStrategy.start(StartableCloseableSafeLifecyleStrategy.java:40)
at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84)
at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169)
at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132)
at org.picocontainer.behaviors.Stored.start(Stored.java:110)
at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1016)
at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1009)
at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:767)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.server.platform.platformlevel.PlatformLevel.start(PlatformLevel.java:90)
at org.sonar.server.platform.platformlevel.PlatformLevel1.start(PlatformLevel1.java:166)
at org.sonar.server.platform.PlatformImpl.start(PlatformImpl.java:213)
at org.sonar.server.platform.PlatformImpl.startLevel1Container(PlatformImpl.java:172)
at org.sonar.server.platform.PlatformImpl.init(PlatformImpl.java:86)
at org.sonar.server.platform.web.PlatformServletContextListener.contextInitialized(PlatformServletContextListener.java:43)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4689)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5155)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1412)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1402)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalStateException: Can not connect to database. Please check connectivity and settings (see the properties prefixed by ‘sonar.jdbc.’).
at org.sonar.db.DefaultDatabase.checkConnection(DefaultDatabase.java:118)
at org.sonar.db.DefaultDatabase.start(DefaultDatabase.java:83)
… 24 common frames omitted
Caused by: java.sql.SQLException: Cannot create PoolableConnectionFactory (Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.)
at org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:669)
at org.apache.commons.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:544)
at org.apache.commons.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:753)
at org.sonar.db.profiling.NullConnectionInterceptor.getConnection(NullConnectionInterceptor.java:31)
at org.sonar.db.profiling.ProfiledDataSource.getConnection(ProfiledDataSource.java:317)
at org.sonar.db.DefaultDatabase.checkConnection(DefaultDatabase.java:115)
… 25 common frames omitted
Caused by: org.postgresql.util.PSQLException: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:285)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)
at org.postgresql.jdbc.PgConnection.(PgConnection.java:217)
at org.postgresql.Driver.makeConnection(Driver.java:458)
at org.postgresql.Driver.connect(Driver.java:260)
at org.apache.commons.dbcp2.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:55)
at org.apache.commons.dbcp2.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:355)
at org.apache.commons.dbcp2.BasicDataSource.validateConnectionFactory(BasicDataSource.java:115)
at org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:665)
… 30 common frames omitted
Caused by: java.net.ConnectException: Connection refused (Connection refused)
at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
at java.base/java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.base/java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.base/java.net.SocksSocketImpl.connect(Unknown Source)
at java.base/java.net.Socket.connect(Unknown Source)
at org.postgresql.core.PGStream.(PGStream.java:81)
at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:93)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:197)
… 38 common frames omitted
…OTHER TRACE…

n java.base@11.0.6/java.lang.Thread.run(Unknown Source)
2020.09.07 10:33:57 INFO web[o.s.s.a.EmbeddedTomcat] HTTP connector enabled on port 9000
2020.09.07 10:33:57 INFO web[o.s.p.ProcessEntryPoint] Hard stopping process

It seems to be the DB connection that failed.
DB systeme is postGresql
Note that a direct connection to DB “Sonarqube_DB” works correctly in command line locally in the same machine : psql -h localhost -U sonarqube -p 5432 sonarqube_DB --> Command works fine.

But docker startup does not

Hi @Vince3S ,

welcome to the community :wave:

SONARQUBE_JDBC_URL=jdbc:postgresql://localhost:5432/sonarqube_DB

when you specify something with localhost in docker it will resolve in localhost within the docker container and there is no postgresql database running within the sonarqube container.
you can include the database in your compose stack and use the service name for the database connection or use the public ip addresse of your database in the JDBC URL

hope that helps

Hi @Tobias_Trabelsi,

Thank you for your help.

Youe message guide me and I found the solution thanks to your explanation.

I just added
network_mode: "host" in the yml that now become :

version: ‘2’

services:
sonarqube:
image: ‘sonarqube:8.4.1-developer’
container_name: sonarqube

restart: always
environment:
   - SONARQUBE_JDBC_URL=jdbc:postgresql://localhost:5432/sonarqube_DB
   - SONARQUBE_JDBC_USERNAME=sonarqube
   - SONARQUBE_JDBC_PASSWORD=sonarqube

volumes:
- '/srv/sonarqube/sonarqube_logs:/opt/sonarqube/logs'
- '/srv/sonarqube/sonarqube_data:/opt/sonarqube/data'
- '/srv/sonarqube/sonarqube_extensions:/opt/sonarqube/extensions'


ports:
 - 9000:9000

network_mode: "host"

It works i I can now connect to the web adress : http://my_adress:9000/projects/favorite !

Thank you again

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.