SonarQube stops shortly after starting

Hi.
I’m trying to install ‘SonarQube 7.9’ on ‘Centos 7’ so I created a system user to run SonarQube service. and I’m using Java 11 and postgre as database.
So after installation and editing the ‘sonar.properties’ file I try to run the service but it stops shortly after. seems the problem is with Elasticsearch module although I precised in the script file ‘sonar.sh’ the user running the service.
RUN_AS_USER=?????


This is what the ‘sonar.log’ file looks like:

--> Wrapper Started as Daemon
Launching a JVM...
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
  Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.

2019.08.23 14:25:26 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp
2019.08.23 14:25:26 INFO  app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
2019.08.23 14:25:26 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch
2019.08.23 14:25:26 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2019.08.23 14:25:26 INFO  app[][o.e.p.PluginsService] no modules loaded
2019.08.23 14:25:26 INFO  app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
2019.08.23 14:25:31 WARN  app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 1
2019.08.23 14:25:31 INFO  app[][o.s.a.SchedulerImpl] Process[es] is stopped
2019.08.23 14:25:31 INFO  app[][o.s.a.SchedulerImpl] SonarQube is stopped
<-- Wrapper Stopped
--> Wrapper Started as Daemon
Launching a JVM...
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
  Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.

2019.08.23 14:32:59 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp
2019.08.23 14:32:59 INFO  app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
2019.08.23 14:33:00 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch
2019.08.23 14:33:00 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2019.08.23 14:33:00 INFO  app[][o.e.p.PluginsService] no modules loaded
2019.08.23 14:33:00 INFO  app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
2019.08.23 14:33:05 WARN  app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 1
2019.08.23 14:33:05 INFO  app[][o.s.a.SchedulerImpl] Process[es] is stopped
2019.08.23 14:33:05 INFO  app[][o.s.a.SchedulerImpl] SonarQube is stopped
<-- Wrapper Stopped

And this is the es.log file

2019.08.23 14:33:05 ERROR es[][o.e.b.Bootstrap] Exception
java.lang.RuntimeException: can not run elasticsearch as root
        at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:103) ~[elasticsearch-6.8.0.jar:6.8.0]
        at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:170) ~[elasticsearch-6.8.0.jar:6.8.0]
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:333) [elasticsearch-6.8.0.jar:6.8.0]
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) [elasticsearch-6.8.0.jar:6.8.0]
        at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) [elasticsearch-6.8.0.jar:6.8.0]
        at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) [elasticsearch-6.8.0.jar:6.8.0]
        at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) [elasticsearch-cli-6.8.0.jar:6.8.0]
        at org.elasticsearch.cli.Command.main(Command.java:90) [elasticsearch-cli-6.8.0.jar:6.8.0]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:116) [elasticsearch-6.8.0.jar:6.8.0]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) [elasticsearch-6.8.0.jar:6.8.0]
2019.08.23 14:33:05 WARN  es[][o.e.b.ElasticsearchUncaughtExceptionHandler] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:163) ~[elasticsearch-6.8.0.jar:6.8.0]
        at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) ~[elasticsearch-6.8.0.jar:6.8.0]
        at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.8.0.jar:6.8.0]
        at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.8.0.jar:6.8.0]
        at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.8.0.jar:6.8.0]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:116) ~[elasticsearch-6.8.0.jar:6.8.0]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) ~[elasticsearch-6.8.0.jar:6.8.0]
Caused by: java.lang.RuntimeException: can not run elasticsearch as root
        at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:103) ~[elasticsearch-6.8.0.jar:6.8.0]
        at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:170) ~[elasticsearch-6.8.0.jar:6.8.0]
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:333) ~[elasticsearch-6.8.0.jar:6.8.0]
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-6.8.0.jar:6.8.0]
        ... 6 more

Thank you, I appreciate your help.

Hi,

Welcome to the community!

How are you starting SonarQube? If you’re starting it directly from the command line, you may find this useful:

 
Ann

1 Like

Hi @ganncamp thnk you for your reply.
Yes I’m trying to start SonarQube from the command line. I give the system user lunching the SonarQube service the permission to write in the log files and turned out the problem was that

 file descriptors [65000] for elasticsearch process is too low, increase to 
at least [65536]

I fixed that and SonarQube still stops after starting.
This is what the log files are mentioning now.

the ‘sonar.log’ file

--> Wrapper Started as Daemon
Launching a JVM...
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
  Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.

2019.08.28 11:34:13 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp
2019.08.28 11:34:13 INFO  app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
2019.08.28 11:34:13 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch
2019.08.28 11:34:13 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2019.08.28 11:34:14 INFO  app[][o.e.p.PluginsService] no modules loaded
2019.08.28 11:34:14 INFO  app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
2019.08.28 11:34:31 INFO  app[][o.s.a.SchedulerImpl] Process[es] is up
2019.08.28 11:34:31 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[[key='web', ipcIndex=2, logFilenamePrefix=web]] from [/opt/sonarqube]: /usr/lib/jvm/java-11-openjdk-11.0.4.11-0.el7_6.x86_64/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/opt/sonarqube/temp --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.5.jar org.sonar.server.app.WebServer /opt/sonarqube/temp/sq-process5401435072087935808properties
2019.08.28 11:34:38 INFO  app[][o.s.a.SchedulerImpl] Process[web] is stopped
2019.08.28 11:34:38 WARN  app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 143
2019.08.28 11:34:38 INFO  app[][o.s.a.SchedulerImpl] Process[es] is stopped
2019.08.28 11:34:38 INFO  app[][o.s.a.SchedulerImpl] SonarQube is stopped
<-- Wrapper Stopped

the ‘es.log’ file

2019.08.28 11:34:19 INFO  es[][o.e.e.NodeEnvironment] using [1] data paths, mounts [[/ (rootfs)]], net usable_space [14.4gb], net total_space [16.9gb], types [rootfs]
2019.08.28 11:34:19 INFO  es[][o.e.e.NodeEnvironment] heap size [503.6mb], compressed ordinary object pointers [true]
2019.08.28 11:34:19 INFO  es[][o.e.n.Node] node name [sonarqube], node ID [H3tYSRosQRiWGlnQkgS6oQ]
2019.08.28 11:34:19 INFO  es[][o.e.n.Node] version[6.8.0], pid[3247], build[default/tar/65b6179/2019-05-15T20:06:13.172855Z], OS[Linux/3.10.0-957.27.2.el7.x86_64/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/11.0.4/11.0.4+11-LTS]
2019.08.28 11:34:19 INFO  es[][o.e.n.Node] JVM arguments [-XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.io.tmpdir=/opt/sonarqube/temp, -XX:ErrorFile=../logs/es_hs_err_pid%p.log, -Des.enforce.bootstrap.checks=true, -Xms512m, -Xmx512m, -XX:+HeapDumpOnOutOfMemoryError, -Des.path.home=/opt/sonarqube/elasticsearch, -Des.path.conf=/opt/sonarqube/temp/conf/es, -Des.distribution.flavor=default, -Des.distribution.type=tar]
2019.08.28 11:34:20 INFO  es[][o.e.p.PluginsService] loaded module [analysis-common]
2019.08.28 11:34:20 INFO  es[][o.e.p.PluginsService] loaded module [lang-painless]
2019.08.28 11:34:20 INFO  es[][o.e.p.PluginsService] loaded module [mapper-extras]
2019.08.28 11:34:20 INFO  es[][o.e.p.PluginsService] loaded module [parent-join]
2019.08.28 11:34:20 INFO  es[][o.e.p.PluginsService] loaded module [percolator]
2019.08.28 11:34:20 INFO  es[][o.e.p.PluginsService] loaded module [reindex]
2019.08.28 11:34:20 INFO  es[][o.e.p.PluginsService] loaded module [repository-url]
2019.08.28 11:34:20 INFO  es[][o.e.p.PluginsService] loaded module [transport-netty4]
2019.08.28 11:34:20 INFO  es[][o.e.p.PluginsService] no plugins loaded
2019.08.28 11:34:23 WARN  es[][o.e.d.c.s.Settings] [http.enabled] setting was deprecated in Elasticsearch and will be removed in a future release! See the breaking changes documentation for the next major version.
2019.08.28 11:34:25 INFO  es[][o.e.d.DiscoveryModule] using discovery type [zen] and host providers [settings]
2019.08.28 11:34:26 INFO  es[][o.e.n.Node] initialized
2019.08.28 11:34:26 INFO  es[][o.e.n.Node] starting ...
2019.08.28 11:34:26 INFO  es[][o.e.t.TransportService] publish_address {127.0.0.1:9001}, bound_addresses {127.0.0.1:9001}
2019.08.28 11:34:26 INFO  es[][o.e.b.BootstrapChecks] explicitly enforcing bootstrap checks
2019.08.28 11:34:29 INFO  es[][o.e.c.s.MasterService] zen-disco-elected-as-master ([0] nodes joined), reason: new_master {sonarqube}{H3tYSRosQRiWGlnQkgS6oQ}{F6xfTdbNSeKZSrHEbkax0w}{127.0.0.1}{127.0.0.1:9001}{rack_id=sonarqube}
2019.08.28 11:34:29 INFO  es[][o.e.c.s.ClusterApplierService] new_master {sonarqube}{H3tYSRosQRiWGlnQkgS6oQ}{F6xfTdbNSeKZSrHEbkax0w}{127.0.0.1}{127.0.0.1:9001}{rack_id=sonarqube}, reason: apply cluster state (from master [master {sonarqube}{H3tYSRosQRiWGlnQkgS6oQ}{F6xfTdbNSeKZSrHEbkax0w}{127.0.0.1}{127.0.0.1:9001}{rack_id=sonarqube} committed version [1] source [zen-disco-elected-as-master ([0] nodes joined)]])
2019.08.28 11:34:29 INFO  es[][o.e.n.Node] started
2019.08.28 11:34:30 INFO  es[][o.e.g.GatewayService] recovered [0] indices into cluster_state
2019.08.28 11:34:38 INFO  es[][o.e.n.Node] stopping ...
2019.08.28 11:34:38 INFO  es[][o.e.n.Node] stopped
2019.08.28 11:34:38 INFO  es[][o.e.n.Node] closing ...
2019.08.28 11:34:38 INFO  es[][o.e.n.Node] closed

the ‘web.log’ file

                at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:514)
                at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:141)
                at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:201)
                ... 38 common frames omitted
2019.08.28 11:34:38 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:
 java.base@11.0.4/java.lang.Thread.sleep(Native Method)
 app//org.elasticsearch.threadpool.ThreadPool$CachedTimeThread.run(ThreadPool.java:574)
2019.08.28 11:34:38 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:
 java.base@11.0.4/jdk.internal.misc.Unsafe.park(Native Method)
 java.base@11.0.4/java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:234)
 java.base@11.0.4/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2123)
 java.base@11.0.4/java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1182)
 java.base@11.0.4/java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:899)
 java.base@11.0.4/java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1054)
 java.base@11.0.4/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1114)
 java.base@11.0.4/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
 java.base@11.0.4/java.lang.Thread.run(Thread.java:834)
2019.08.28 11:34:38 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:
 java.base@11.0.4/sun.nio.ch.EPoll.wait(Native Method)
 java.base@11.0.4/sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:120)
 java.base@11.0.4/sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:124)
 java.base@11.0.4/sun.nio.ch.SelectorImpl.select(SelectorImpl.java:136)
 app//io.netty.channel.nio.SelectedSelectionKeySetSelector.select(SelectedSelectionKeySetSelector.java:62)
 app//io.netty.channel.nio.NioEventLoop.select(NioEventLoop.java:765)
 app//io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:413)
 app//io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:909)
 java.base@11.0.4/java.lang.Thread.run(Thread.java:834)
2019.08.28 11:34:38 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:
 java.base@11.0.4/jdk.internal.misc.Unsafe.park(Native Method)
 java.base@11.0.4/java.util.concurrent.locks.LockSupport.park(LockSupport.java:194)
 java.base@11.0.4/java.util.concurrent.LinkedTransferQueue.awaitMatch(LinkedTransferQueue.java:743)
 java.base@11.0.4/java.util.concurrent.LinkedTransferQueue.xfer(LinkedTransferQueue.java:684)
 java.base@11.0.4/java.util.concurrent.LinkedTransferQueue.take(LinkedTransferQueue.java:1366)
 java.base@11.0.4/java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1054)
 java.base@11.0.4/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1114)
 java.base@11.0.4/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
 java.base@11.0.4/java.lang.Thread.run(Thread.java:834)
2019.08.28 11:34:38 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:
 java.base@11.0.4/sun.nio.ch.EPoll.wait(Native Method)
 java.base@11.0.4/sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:120)
 java.base@11.0.4/sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:124)
 java.base@11.0.4/sun.nio.ch.SelectorImpl.select(SelectorImpl.java:136)
 app//io.netty.channel.nio.SelectedSelectionKeySetSelector.select(SelectedSelectionKeySetSelector.java:62)
 app//io.netty.channel.nio.NioEventLoop.select(NioEventLoop.java:765)
 app//io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:413)
 app//io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:909)
 java.base@11.0.4/java.lang.Thread.run(Thread.java:834)
2019.08.28 11:34:38 INFO  web[][o.s.s.a.EmbeddedTomcat] HTTP connector enabled on port 9000
2019.08.28 11:34:38 INFO  web[][o.s.p.ProcessEntryPoint] Hard stopping process

Hi,

Your web.log file starts in mid-stacktrace. Since sonar.log starts at 11:34:13, and the first timestamp in web.log is 11:34:38, I’m confident the rest of the missing stacktrace is relevant.

 
Ann

@ganncamp yes you are right, my bad.
this is the whole log

2019.08.28 11:34:32 INFO  web[][o.s.p.ProcessEntryPoint] Starting web
2019.08.28 11:34:34 INFO  web[][o.a.t.u.n.NioSelectorPool] Using a shared selector for servlet write/read
2019.08.28 11:34:35 INFO  web[][o.e.p.PluginsService] no modules loaded
2019.08.28 11:34:35 INFO  web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.join.ParentJoinPlugin]
2019.08.28 11:34:35 INFO  web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.percolator.PercolatorPlugin]
2019.08.28 11:34:35 INFO  web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
2019.08.28 11:34:38 INFO  web[][o.s.s.e.EsClientProvider] Connected to local Elasticsearch: [127.0.0.1:9001]
2019.08.28 11:34:38 INFO  web[][o.s.s.p.LogServerVersion] SonarQube Server / 7.9.0.26994 / 687d8007c0f62bfaaa44a890d93397de0a588119
2019.08.28 11:34:38 INFO  web[][o.sonar.db.Database] Create JDBC data source for jdbc:postgresql://localhost/sonarqube?currentSchema=my_schema
2019.08.28 11:34:38 ERROR web[][o.s.s.p.Platform] Web server startup failed
java.lang.IllegalStateException: Fail to connect to database
        at org.sonar.db.DefaultDatabase.start(DefaultDatabase.java:90)
        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:135)
        at org.sonar.server.platform.platformlevel.PlatformLevel.start(PlatformLevel.java:90)
        at org.sonar.server.platform.platformlevel.PlatformLevel1.start(PlatformLevel1.java:160)
        at org.sonar.server.platform.Platform.start(Platform.java:211)
        at org.sonar.server.platform.Platform.startLevel1Container(Platform.java:170)
        at org.sonar.server.platform.Platform.init(Platform.java:86)
        at org.sonar.server.platform.web.PlatformServletContextListener.contextInitialized(PlatformServletContextListener.java:43)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4817)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5283)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1423)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1413)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:834)
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:134)
        at org.sonar.db.DefaultDatabase.start(DefaultDatabase.java:87)
        ... 24 common frames omitted
Caused by: java.sql.SQLException: Cannot create PoolableConnectionFactory (FATAL: Ident authentication failed for user "sonar")
        at org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:2385)
        at org.apache.commons.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:2110)
        at org.apache.commons.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1563)
        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:131)
        ... 25 common frames omitted
Caused by: org.postgresql.util.PSQLException: FATAL: Ident authentication failed for user "sonar"
        at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:514)
        at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:141)
        at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:192)
        at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)
        at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:195)
        at org.postgresql.Driver.makeConnection(Driver.java:454)
        at org.postgresql.Driver.connect(Driver.java:256)
        at org.apache.commons.dbcp2.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:53)
        at org.apache.commons.dbcp2.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:291)
        at org.apache.commons.dbcp2.BasicDataSource.validateConnectionFactory(BasicDataSource.java:2395)
        at org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:2381)
        ... 30 common frames omitted
        Suppressed: org.postgresql.util.PSQLException: FATAL: Ident authentication failed for user "sonar"
                at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:514)
                at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:141)
                at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:201)
                ... 38 common frames omitted
2019.08.28 11:34:38 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:
 java.base@11.0.4/java.lang.Thread.sleep(Native Method)
 app//org.elasticsearch.threadpool.ThreadPool$CachedTimeThread.run(ThreadPool.java:574)
2019.08.28 11:34:38 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:
 java.base@11.0.4/jdk.internal.misc.Unsafe.park(Native Method)
 java.base@11.0.4/java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:234)
 java.base@11.0.4/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2123)
 java.base@11.0.4/java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1182)
 java.base@11.0.4/java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:899)
 java.base@11.0.4/java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1054)
 java.base@11.0.4/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1114)
 java.base@11.0.4/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
 java.base@11.0.4/java.lang.Thread.run(Thread.java:834)
2019.08.28 11:34:38 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:
 java.base@11.0.4/sun.nio.ch.EPoll.wait(Native Method)
 java.base@11.0.4/sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:120)
 java.base@11.0.4/sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:124)
 java.base@11.0.4/sun.nio.ch.SelectorImpl.select(SelectorImpl.java:136)
 app//io.netty.channel.nio.SelectedSelectionKeySetSelector.select(SelectedSelectionKeySetSelector.java:62)
 app//io.netty.channel.nio.NioEventLoop.select(NioEventLoop.java:765)
 app//io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:413)
 app//io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:909)
 java.base@11.0.4/java.lang.Thread.run(Thread.java:834)
2019.08.28 11:34:38 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:
 java.base@11.0.4/jdk.internal.misc.Unsafe.park(Native Method)
 java.base@11.0.4/java.util.concurrent.locks.LockSupport.park(LockSupport.java:194)
 java.base@11.0.4/java.util.concurrent.LinkedTransferQueue.awaitMatch(LinkedTransferQueue.java:743)
 java.base@11.0.4/java.util.concurrent.LinkedTransferQueue.xfer(LinkedTransferQueue.java:684)
 java.base@11.0.4/java.util.concurrent.LinkedTransferQueue.take(LinkedTransferQueue.java:1366)
 java.base@11.0.4/java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1054)
 java.base@11.0.4/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1114)
 java.base@11.0.4/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
 java.base@11.0.4/java.lang.Thread.run(Thread.java:834)
2019.08.28 11:34:38 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:
 java.base@11.0.4/sun.nio.ch.EPoll.wait(Native Method)
 java.base@11.0.4/sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:120)
 java.base@11.0.4/sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:124)
 java.base@11.0.4/sun.nio.ch.SelectorImpl.select(SelectorImpl.java:136)
 app//io.netty.channel.nio.SelectedSelectionKeySetSelector.select(SelectedSelectionKeySetSelector.java:62)
 app//io.netty.channel.nio.NioEventLoop.select(NioEventLoop.java:765)
 app//io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:413)
 app//io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:909)
 java.base@11.0.4/java.lang.Thread.run(Thread.java:834)
2019.08.28 11:34:38 INFO  web[][o.s.s.a.EmbeddedTomcat] HTTP connector enabled on port 9000
2019.08.28 11:34:38 INFO  web[][o.s.p.ProcessEntryPoint] Hard stopping process

Hi,

It seems that you need to take another look at your DB connection settings.

 
Ann

@ganncamp yes the problem seems the DB connection, but I still can’t figure it out !
These are the changes I made in the ‘sonar.properties’ file

sonar.jdbc.username=sonar
sonar.jdbc.password=********
sonar.jdbc.url=jdbc:postgresql://localhost/sonar?currentSchema=my_schema

As for the postgres, I created the SonarQube database. and gave permission to the system user to make changes in the database.

Hi,

Is your schema named “my_schema”? And is your Postgres instance actually on the same host as SonarQube? (This setup is not recommended for production…). For my localhost testing purposes this works for me: sonar.jdbc.url=jdbc:postgresql://localhost/sonar. But you really do need to customize not just the credentials but also your JDBC URL to match your situation.

 
HTH,
Ann