Sonarqube won't connect to external postgres DB

I’m having a issue getting my SonarQube instance up and running. We are able to install Sonarqube on a Linux server and connect it to a external Azure PaaS PostgreSQl database instance this is cause the Sonarqube service to not start is there a way we can get assistance with this issue?

So you installed Sonarqube and is not able to connect to the azure database instance, right? Is there anything in the error log? Have you tried, say, running a postgresql db in another host which is local to your sonarqube instance (a docker container would suffice) to see if the problem follows sonarqube or the database server?

Welcome to the community forum! Are you using SonarQube 8.5? There is a known issue with Azure PaaS PostgresSQL detailed here, with a workaround.

2 Likes

Thank you for your response. The workaround that you provided is for the community version, does this same workaround apply to the enterprise edition?

Yes, it applies to all SonarQube editions :slight_smile:

Good afternoon Pierre,

We are now getting this error message:

2020.10.22 20:17:55 INFO  web[][o.s.p.ProcessEntryPoint] Starting web
2020.10.22 20:17:56 ERROR web[][o.s.s.a.EmbeddedTomcat] Fail to start web server
org.apache.catalina.LifecycleException: Failed to initialize connector [Connector[HTTP/1.1-80]]
        at org.apache.catalina.core.StandardService.initInternal(StandardService.java:559)
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
        at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:848)
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:173)
        at org.apache.catalina.startup.Tomcat.start(Tomcat.java:440)
        at org.sonar.server.app.EmbeddedTomcat.start(EmbeddedTomcat.java:66)
        at org.sonar.server.app.WebServer.start(WebServer.java:52)
        at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:97)
        at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:81)
        at org.sonar.server.app.WebServer.main(WebServer.java:99)
2020.10.22 20:17:56 WARN  web[][o.s.p.ProcessEntryPoint] Fail to start web
java.lang.RuntimeException: org.apache.catalina.LifecycleException: Failed to initialize connector [Connector[HTTP/1.1-80]]
        at com.google.common.base.Throwables.propagate(Throwables.java:241)
        at org.sonar.server.app.EmbeddedTomcat.start(EmbeddedTomcat.java:70)
        at org.sonar.server.app.WebServer.start(WebServer.java:52)
        at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:97)
        at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:81)
        at org.sonar.server.app.WebServer.main(WebServer.java:99)
Caused by: org.apache.catalina.LifecycleException: Failed to initialize connector [Connector[HTTP/1.1-80]]
        at org.apache.catalina.core.StandardService.initInternal(StandardService.java:559)
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
        at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:848)
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:173)
        at org.apache.catalina.startup.Tomcat.start(Tomcat.java:440)
        at org.sonar.server.app.EmbeddedTomcat.start(EmbeddedTomcat.java:66)
        ... 4 common frames omitted
2020.10.22 20:17:56 INFO  web[][o.s.p.ProcessEntryPoint] Hard stopping process
2020.10.22 20:39:50 INFO  web[][o.s.p.ProcessEntryPoint] Starting web
2020.10.22 20:39:51 ERROR web[][o.s.s.a.EmbeddedTomcat] Fail to start web server
org.apache.catalina.LifecycleException: Failed to initialize connector [Connector[HTTP/1.1-80]]
        at org.apache.catalina.core.StandardService.initInternal(StandardService.java:559)
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
        at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:848)
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:173)
        at org.apache.catalina.startup.Tomcat.start(Tomcat.java:440)
        at org.sonar.server.app.EmbeddedTomcat.start(EmbeddedTomcat.java:66)
        at org.sonar.server.app.WebServer.start(WebServer.java:52)
        at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:97)
        at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:81)
        at org.sonar.server.app.WebServer.main(WebServer.java:99)
2020.10.22 20:39:51 WARN  web[][o.s.p.ProcessEntryPoint] Fail to start web
java.lang.RuntimeException: org.apache.catalina.LifecycleException: Failed to initialize connector [Connector[HTTP/1.1-80]]
        at com.google.common.base.Throwables.propagate(Throwables.java:241)
        at org.sonar.server.app.EmbeddedTomcat.start(EmbeddedTomcat.java:70)
        at org.sonar.server.app.WebServer.start(WebServer.java:52)
        at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:97)
        at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:81)
        at org.sonar.server.app.WebServer.main(WebServer.java:99)
Caused by: org.apache.catalina.LifecycleException: Failed to initialize connector [Connector[HTTP/1.1-80]]
        at org.apache.catalina.core.StandardService.initInternal(StandardService.java:559)
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
        at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:848)
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)

The service starts, will run for a couple minutes, then stop. Are you able to assist?

Hi! Any other errors in the other log files (web.log, sonar,log, es.log)?

The only thing I see here is the Connector on TCP port 80 failing, one of the cause could be that this TCP port is already taken.

Changed the port number getting the following error message in the web.log:

2020.10.23 13:08:04 INFO  web[][o.s.p.ProcessEntryPoint] Starting web
2020.10.23 13:08:05 ERROR web[][o.s.s.a.EmbeddedTomcat] Fail to start web server
org.apache.catalina.LifecycleException: Failed to initialize connector [Connector[HTTP/1.1-9000]]
        at org.apache.catalina.core.StandardService.initInternal(StandardService.java:559)
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
        at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:848)
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:173)
        at org.apache.catalina.startup.Tomcat.start(Tomcat.java:440)
        at org.sonar.server.app.EmbeddedTomcat.start(EmbeddedTomcat.java:66)
        at org.sonar.server.app.WebServer.start(WebServer.java:52)
        at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:97)
        at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:81)
        at org.sonar.server.app.WebServer.main(WebServer.java:99)
2020.10.23 13:08:05 WARN  web[][o.s.p.ProcessEntryPoint] Fail to start web
java.lang.RuntimeException: org.apache.catalina.LifecycleException: Failed to initialize connector [Connector[HTTP/1.1-9000]]
        at com.google.common.base.Throwables.propagate(Throwables.java:241)
        at org.sonar.server.app.EmbeddedTomcat.start(EmbeddedTomcat.java:70)
        at org.sonar.server.app.WebServer.start(WebServer.java:52)
        at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:97)
        at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:81)
        at org.sonar.server.app.WebServer.main(WebServer.java:99)
Caused by: org.apache.catalina.LifecycleException: Failed to initialize connector [Connector[HTTP/1.1-9000]]
        at org.apache.catalina.core.StandardService.initInternal(StandardService.java:559)
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
        at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:848)
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:173)
        at org.apache.catalina.startup.Tomcat.start(Tomcat.java:440)
        at org.sonar.server.app.EmbeddedTomcat.start(EmbeddedTomcat.java:66)
        ... 4 common frames omitted

web.log:

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

2020.10.22 20:17:40 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /home/xxxx/sonarqube-8.5.0.37579/temp
2020.10.22 20:17:40 INFO  app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
2020.10.22 20:17:41 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/home/xxxx/sonarqube-8.5.0.37579/elasticsearch]: /home/xxxx/sonarqube-8.5.0.37579/elastics$2020.10.22 20:17:41 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
2020.10.22 20:17:41 INFO  app[][o.e.p.PluginsService] no modules loaded
2020.10.22 20:17:41 INFO  app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
2020.10.22 20:17:54 INFO  app[][o.s.a.SchedulerImpl] Process[es] is up
2020.10.22 20:17:54 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[[key='web', ipcIndex=2, logFilenamePrefix=web]] from [/home/xxxx/sonarqube-8.5.0.37579]: /usr/lib/jvm/java-11-openjdk-11.0.8.10-0.el8_2.x86_64/bi$2020.10.22 20:17:56 INFO  app[][o.s.a.SchedulerImpl] Process[web] is stopped
2020.10.22 20:17:56 INFO  app[][o.s.a.SchedulerImpl] Process[es] is stopped
2020.10.22 20:17:56 INFO  app[][o.s.a.SchedulerImpl] SonarQube is stopped
2020.10.22 20:17:56 WARN  app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 143
<-- 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.

2020.10.22 20:39:36 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /home/xxxx/sonarqube-8.5.0.37579/temp
2020.10.22 20:39:36 INFO  app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
2020.10.22 20:39:36 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/home/xxxx/sonarqube-8.5.0.37579/elasticsearch]: /home/xxxx/sonarqube-8.5.0.37579/elastics$2020.10.22 20:39:36 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2020.10.22 20:39:36 INFO  app[][o.e.p.PluginsService] no modules loaded
2020.10.22 20:39:36 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.
2020.10.22 20:39:50 INFO  app[][o.s.a.SchedulerImpl] Process[es] is up
2020.10.22 20:39:50 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[[key='web', ipcIndex=2, logFilenamePrefix=web]] from [/home/xxxx/sonarqube-8.5.0.37579]: /usr/lib/jvm/java-11-openjdk-11.0.8.10-0.el8_2.x86_64/bi$2020.10.22 20:39:51 INFO  app[][o.s.a.SchedulerImpl] Process[web] is stopped
2020.10.22 20:39:51 WARN  app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 143
2020.10.22 20:39:51 INFO  app[][o.s.a.SchedulerImpl] Process[es] is stopped
2020.10.22 20:39:51 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.

2020.10.22 21:02:41 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /home/afcmade/sonarqube-8.5.0.37579/temp
2020.10.22 21:02:41 INFO  app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
2020.10.22 21:02:42 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/home/xxxx/sonarqube-8.5.0.37579/elasticsearch]: /home/xxxx/sonarqube-8.5.0.37579/elastics$2020.10.22 21:02:42 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
2020.10.22 21:02:42 INFO  app[][o.e.p.PluginsService] no modules loaded
2020.10.22 21:02:42 INFO  app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
2020.10.22 21:02:56 INFO  app[][o.s.a.SchedulerImpl] Process[es] is up
2020.10.22 21:02:56 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[[key='web', ipcIndex=2, logFilenamePrefix=web]] from [/home/xxxx/sonarqube-8.5.0.37579]: /usr/lib/jvm/java-11-openjdk-11.0.8.10-0.el8_2.x86_64/bi$2020.10.22 21:02:57 INFO  app[][o.s.a.SchedulerImpl] Process[web] is stopped
2020.10.22 21:02:57 WARN  app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 143
2020.10.22 21:02:57 INFO  app[][o.s.a.SchedulerImpl] Process[es] is stopped
2020.10.22 21:02:57 INFO  app[][o.s.a.SchedulerImpl] SonarQube is stopped
<-- Wrapper Stopped
--> Wrapper Started as Daemon
Launching a JVM...

es.log:

2020.10.23 13:07:53 INFO  es[][o.e.e.NodeEnvironment] using [1] data paths, mounts [[/ (/dev/sda2)]], net usable_space [26.3gb], net total_space [29gb], types [xfs]
2020.10.23 13:07:53 INFO  es[][o.e.e.NodeEnvironment] heap size [1.9gb], compressed ordinary object pointers [true]
2020.10.23 13:07:53 INFO  es[][o.e.n.Node] node name [sonarqube], node ID [fJB06GFHRQW_IrKJq2T8ig]
2020.10.23 13:07:53 INFO  es[][o.e.n.Node] version[6.8.4], pid[37536], build[default/tar/bca0c8d/2019-10-16T06:19:49.319352Z], OS[Linux/4.18.0-193.19.1.el8_2.x86_64/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/1$2020.10.23 13:07:53 INFO  es[][o.e.n.Node] JVM arguments [-XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.nega$2020.10.23 13:07:54 INFO  es[][o.e.p.PluginsService] loaded module [analysis-common]
2020.10.23 13:07:54 INFO  es[][o.e.p.PluginsService] loaded module [lang-painless]
2020.10.23 13:07:54 INFO  es[][o.e.p.PluginsService] loaded module [mapper-extras]
2020.10.23 13:07:54 INFO  es[][o.e.p.PluginsService] loaded module [parent-join]
2020.10.23 13:07:54 INFO  es[][o.e.p.PluginsService] loaded module [percolator]
2020.10.23 13:07:54 INFO  es[][o.e.p.PluginsService] loaded module [repository-url]
2020.10.23 13:07:54 INFO  es[][o.e.p.PluginsService] loaded module [transport-netty4]
2020.10.23 13:07:54 INFO  es[][o.e.p.PluginsService] no plugins loaded
2020.10.23 13:07:57 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.
2020.10.23 13:07:59 INFO  es[][o.e.d.DiscoveryModule] using discovery type [zen] and host providers [settings]
2020.10.23 13:07:59 INFO  es[][o.e.n.Node] initialized
2020.10.23 13:07:59 INFO  es[][o.e.n.Node] starting ...
2020.10.23 13:08:00 INFO  es[][o.e.t.TransportService] publish_address {127.0.0.1:9001}, bound_addresses {127.0.0.1:9001}
2020.10.23 13:08:00 INFO  es[][o.e.b.BootstrapChecks] explicitly enforcing bootstrap checks
2020.10.23 13:08:03 INFO  es[][o.e.c.s.MasterService] zen-disco-elected-as-master ([0] nodes joined), reason: new_master {sonarqube}{fJB06GFHRQW_IrKJq2T8ig}{EIxAIymFTI-T_lmGlDUbhw}{127.0.0.1}{127.0.0.1:9001}{rack_id=sonarq$2020.10.23 13:08:03 INFO  es[][o.e.c.s.ClusterApplierService] new_master {sonarqube}{fJB06GFHRQW_IrKJq2T8ig}{EIxAIymFTI-T_lmGlDUbhw}{127.0.0.1}{127.0.0.1:9001}{rack_id=sonarqube}, reason: apply cluster state (from master [$2020.10.23 13:08:03 INFO  es[][o.e.n.Node] started
2020.10.23 13:08:03 INFO  es[][o.e.g.GatewayService] recovered [0] indices into cluster_state
2020.10.23 13:08:05 INFO  es[][o.e.n.Node] stopping ...
2020.10.23 13:08:05 INFO  es[][o.e.n.Node] stopped
2020.10.23 13:08:05 INFO  es[][o.e.n.Node] closing ...
2020.10.23 13:08:05 INFO  es[][o.e.n.Node] closed

I also made sure that no other services are using port 80 or 9000.

Hello @tchapm,

You changed a few things along the way and I am not sure of what is the latest situation on the problem. Can you do the following for us to have a clean picture:

  • Stop your SonarQube
  • Delete all files in the <SONARQUBE_INSTALL_DIR>/logs directory
  • Edit the <SONARQUBE_INSTALL_DIR>/conf/sonar.properties file to add: sonar.verbose=true
  • Restart SonarQube

Then please attach to this thread:

  • A zip of the <SONARQUBE_INSTALL_DIR>/logs directory (so that I have all the logs, in sync)
  • Your sonar.properties files so that I can see the details of your configuration

Olivier

Hello @tchapm,

Let’s wrap this thread up. Your platform is now up and running correctly.
For the record the 2 problems were:

  1. You were starting SonarQube as root which is forbidden for security reasons
2020.10.26 15:33:19 ERROR es[][o.e.b.Bootstrap] Exception
java.lang.RuntimeException: can not run elasticsearch as root
  1. You had set the sonar.web.host configuration parameter to the public IP of your SonarQube server instead of one of the internal network interfaces IPs… SonarQube web server could not bind to that IP.
org.apache.catalina.LifecycleException: Failed to initialize connector [Connector[HTTP/1.1-9000]]

When you have only 1 network interface, which is your case AFAIK, it’s better to simply comment the setting.