SonarQube seems to reboot constantly

Hello - I’m working with a SonarQube setup on docker, connecting to an external PostgreSQL setup, but I’m running into an issue where it seems like SonarQube runs into an error and then infinitely reboots.

web.log

2022.07.08 11:58:46 INFO  web[][o.s.p.ProcessEntryPoint] Starting Web Server
2022.07.08 11:58:46 INFO  web[][o.a.t.u.n.NioSelectorPool] Using a shared selector for servlet write/read
2022.07.08 11:58:47 INFO  web[][o.s.s.p.LogServerVersion] SonarQube Server / 9.4.0.54424 / 5c36a2e19337da136080a276102eaaefce073c68
2022.07.08 11:58:48 WARN  web[][o.s.c.a.AnnotationConfigApplicationContext] Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jdk.internal.loader.ClassLoaders$AppClassLoader@55054057-org.sonar.server.platform.db.EmbeddedDatabaseFactory': Init>
2022.07.08 11:58:48 ERROR web[][o.s.s.p.PlatformImpl] Web server startup failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jdk.internal.loader.ClassLoaders$AppClassLoader@55054057-org.sonar.server.platform.db.EmbeddedDatabaseFactory': Initialization of bean failed; nested exception is java.lang.IllegalStateException: Unable to start database
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:628)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:953)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
        at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:187)
        at org.sonar.server.platform.platformlevel.PlatformLevel.start(PlatformLevel.java:80)
        at org.sonar.server.platform.platformlevel.PlatformLevel1.start(PlatformLevel1.java:163)
        at org.sonar.server.platform.PlatformImpl.start(PlatformImpl.java:196)
        at org.sonar.server.platform.PlatformImpl.startLevel1Container(PlatformImpl.java:162)
        at org.sonar.server.platform.PlatformImpl.init(PlatformImpl.java:76)
        at org.sonar.server.platform.web.PlatformServletContextListener.contextInitialized(PlatformServletContextListener.java:43)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4763)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5232)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1427)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1417)
        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:829)
Caused by: java.lang.IllegalStateException: Unable to start database
        at org.sonar.server.platform.db.EmbeddedDatabase.startServer(EmbeddedDatabase.java:88)
        at org.sonar.server.platform.db.EmbeddedDatabase.start(EmbeddedDatabase.java:63)
        at org.sonar.server.platform.db.EmbeddedDatabaseFactory.start(EmbeddedDatabaseFactory.java:49)
        at org.sonar.core.platform.StartableBeanPostProcessor.postProcessBeforeInitialization(StartableBeanPostProcessor.java:33)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:440)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1796)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620)
        ... 24 common frames omitted
Caused by: org.h2.jdbc.JdbcSQLInvalidAuthorizationSpecException: Wrong user name or password [28000-210]
        at org.h2.message.DbException.getJdbcSQLException(DbException.java:529)
        at org.h2.message.DbException.getJdbcSQLException(DbException.java:496)
        at org.h2.message.DbException.get(DbException.java:227)
        at org.h2.message.DbException.get(DbException.java:203)
        at org.h2.message.DbException.get(DbException.java:192)
        at org.h2.engine.Engine.validateUserAndPassword(Engine.java:393)
        at org.h2.engine.Engine.createSession(Engine.java:206)
        at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:338)
        at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:122)
        at org.h2.Driver.connect(Driver.java:59)
        at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:677)
        at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:251)
        at org.sonar.server.platform.db.EmbeddedDatabase.createDatabase(EmbeddedDatabase.java:115)
        at org.sonar.server.platform.db.EmbeddedDatabase.startServer(EmbeddedDatabase.java:79)
        ... 30 common frames omitted

es.log

2022.07.08 11:58:40 INFO  es[][o.e.n.Node] version[7.17.1], pid[12724], build[default/tar/e5acb99f822233d62d6444ce45a4543dc1c8059a/2022-02-23T22:20:54.153567231Z], OS[Linux/5.4.0-121-generic/amd64], JVM[Private Build/OpenJDK 64-Bit Server VM/11.0.15/11.0.15+10-Ubuntu-0ubuntu0.20.04.1]
2022.07.08 11:58:40 INFO  es[][o.e.n.Node] JVM home [/usr/lib/jvm/java-11-openjdk-amd64]
2022.07.08 11:58:40 INFO  es[][o.e.n.Node] JVM arguments [-XX:+UseG1GC, -Djava.io.tmpdir=/opt/sonarqube/temp, -XX:ErrorFile=../logs/es_hs_err_pid%p.log, -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, -Djna.tmpdir=/opt/sonarqube/temp, -X>
2022.07.08 11:58:41 INFO  es[][o.e.p.PluginsService] loaded module [analysis-common]
2022.07.08 11:58:41 INFO  es[][o.e.p.PluginsService] loaded module [lang-painless]
2022.07.08 11:58:41 INFO  es[][o.e.p.PluginsService] loaded module [parent-join]
2022.07.08 11:58:41 INFO  es[][o.e.p.PluginsService] loaded module [reindex]
2022.07.08 11:58:41 INFO  es[][o.e.p.PluginsService] loaded module [transport-netty4]
2022.07.08 11:58:41 INFO  es[][o.e.p.PluginsService] no plugins loaded
2022.07.08 11:58:41 INFO  es[][o.e.e.NodeEnvironment] using [1] data paths, mounts [[/ (/dev/mapper/vg-root)]], net usable_space [20.3gb], net total_space [38.2gb], types [ext4]
2022.07.08 11:58:41 INFO  es[][o.e.e.NodeEnvironment] heap size [512mb], compressed ordinary object pointers [true]
2022.07.08 11:58:41 INFO  es[][o.e.n.Node] node name [sonarqube], node ID [Y6fJpjtoQCaCNWVU2AVCgA], cluster name [sonarqube], roles [data_frozen, master, remote_cluster_client, data, data_content, data_hot, data_warm, data_cold, ingest]
2022.07.08 11:58:44 INFO  es[][o.e.t.NettyAllocator] creating NettyAllocator with the following configs: [name=unpooled, suggested_max_allocation_size=256kb, factors={es.unsafe.use_unpooled_allocator=null, g1gc_enabled=true, g1gc_region_size=1mb, heap_size=512mb}]
2022.07.08 11:58:44 INFO  es[][o.e.i.r.RecoverySettings] using rate limit [40mb] with [default=40mb, read=0b, write=0b, max=0b]
2022.07.08 11:58:44 INFO  es[][o.e.d.DiscoveryModule] using discovery type [zen] and seed hosts providers [settings]
2022.07.08 11:58:44 INFO  es[][o.e.g.DanglingIndicesState] gateway.auto_import_dangling_indices is disabled, dangling indices will not be automatically detected or imported and must be managed manually
2022.07.08 11:58:44 INFO  es[][o.e.n.Node] initialized
2022.07.08 11:58:44 INFO  es[][o.e.n.Node] starting ...
2022.07.08 11:58:45 INFO  es[][o.e.t.TransportService] publish_address {127.0.0.1:43997}, bound_addresses {127.0.0.1:43997}
2022.07.08 11:58:45 INFO  es[][o.e.c.c.Coordinator] cluster UUID [FeU_l11XSB6F5Wn_oKg54A]
2022.07.08 11:58:45 INFO  es[][o.e.c.s.MasterService] elected-as-master ([1] nodes joined)[{sonarqube}{Y6fJpjtoQCaCNWVU2AVCgA}{hZCEdXR9S4m6aSWwyDdv6A}{127.0.0.1}{127.0.0.1:43997}{cdfhimrsw} elect leader, _BECOME_MASTER_TASK_, _FINISH_ELECTION_], term: 16, version: 31, delta: master node changed {previous [], current [{sonarqube}{Y6fJpjtoQCaCNWVU2AVCgA}{hZCEdXR>
2022.07.08 11:58:45 INFO  es[][o.e.c.s.ClusterApplierService] master node changed {previous [], current [{sonarqube}{Y6fJpjtoQCaCNWVU2AVCgA}{hZCEdXR9S4m6aSWwyDdv6A}{127.0.0.1}{127.0.0.1:43997}{cdfhimrsw}]}, term: 16, version: 31, reason: Publication{term=16, version=31}
2022.07.08 11:58:45 INFO  es[][o.e.h.AbstractHttpServerTransport] publish_address {127.0.0.1:9001}, bound_addresses {127.0.0.1:9001}
2022.07.08 11:58:45 INFO  es[][o.e.n.Node] started
2022.07.08 11:58:45 INFO  es[][o.e.g.GatewayService] recovered [0] indices into cluster_state
2022.07.08 11:59:27 INFO  es[][o.e.n.Node] stopping ...
2022.07.08 11:59:27 INFO  es[][o.e.n.Node] stopped
2022.07.08 11:59:27 INFO  es[][o.e.n.Node] closing ...
2022.07.08 11:59:27 INFO  es[][o.e.n.Node] closed
2022.07.08 11:59:32 INFO  es[][o.e.n.Node] version[7.17.1], pid[13053], build[default/tar/e5acb99f822233d62d6444ce45a4543dc1c8059a/2022-02-23T22:20:54.153567231Z], OS[Linux/5.4.0-121-generic/amd64], JVM[Private Build/OpenJDK 64-Bit Server VM/11.0.15/11.0.15+10-Ubuntu-0ubuntu0.20.04.1]
2022.07.08 11:59:32 INFO  es[][o.e.n.Node] JVM home [/usr/lib/jvm/java-11-openjdk-amd64]
2022.07.08 11:59:32 INFO  es[][o.e.n.Node] JVM arguments [-XX:+UseG1GC, -Djava.io.tmpdir=/opt/sonarqube/temp, -XX:ErrorFile=../logs/es_hs_err_pid%p.log, -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, -Djna.tmpdir=/opt/sonarqube/temp, -X>
2022.07.08 11:59:33 INFO  es[][o.e.p.PluginsService] loaded module [analysis-common]
2022.07.08 11:59:33 INFO  es[][o.e.p.PluginsService] loaded module [lang-painless]
2022.07.08 11:59:33 INFO  es[][o.e.p.PluginsService] loaded module [parent-join]
2022.07.08 11:59:33 INFO  es[][o.e.p.PluginsService] loaded module [reindex]
2022.07.08 11:59:33 INFO  es[][o.e.p.PluginsService] loaded module [transport-netty4]
2022.07.08 11:59:33 INFO  es[][o.e.p.PluginsService] no plugins loaded
2022.07.08 11:59:33 INFO  es[][o.e.e.NodeEnvironment] using [1] data paths, mounts [[/ (/dev/mapper/vg-root)]], net usable_space [20.3gb], net total_space [38.2gb], types [ext4]
2022.07.08 11:59:33 INFO  es[][o.e.e.NodeEnvironment] heap size [512mb], compressed ordinary object pointers [true]
2022.07.08 11:59:33 INFO  es[][o.e.n.Node] node name [sonarqube], node ID [Y6fJpjtoQCaCNWVU2AVCgA], cluster name [sonarqube], roles [data_frozen, master, remote_cluster_client, data, data_content, data_hot, data_warm, data_cold, ingest]
2022.07.08 11:59:36 INFO  es[][o.e.t.NettyAllocator] creating NettyAllocator with the following configs: [name=unpooled, suggested_max_allocation_size=256kb, factors={es.unsafe.use_unpooled_allocator=null, g1gc_enabled=true, g1gc_region_size=1mb, heap_size=512mb}]
2022.07.08 11:59:36 INFO  es[][o.e.i.r.RecoverySettings] using rate limit [40mb] with [default=40mb, read=0b, write=0b, max=0b]
2022.07.08 11:59:36 INFO  es[][o.e.d.DiscoveryModule] using discovery type [zen] and seed hosts providers [settings]
2022.07.08 11:59:36 INFO  es[][o.e.g.DanglingIndicesState] gateway.auto_import_dangling_indices is disabled, dangling indices will not be automatically detected or imported and must be managed manually
2022.07.08 11:59:36 INFO  es[][o.e.n.Node] initialized
2022.07.08 11:59:36 INFO  es[][o.e.n.Node] starting ...
2022.07.08 11:59:37 INFO  es[][o.e.t.TransportService] publish_address {127.0.0.1:40629}, bound_addresses {127.0.0.1:40629}
2022.07.08 11:59:37 INFO  es[][o.e.c.c.Coordinator] cluster UUID [FeU_l11XSB6F5Wn_oKg54A]
2022.07.08 11:59:37 INFO  es[][o.e.c.s.MasterService] elected-as-master ([1] nodes joined)[{sonarqube}{Y6fJpjtoQCaCNWVU2AVCgA}{am95DKUUTna8Z3s46NEAeQ}{127.0.0.1}{127.0.0.1:40629}{cdfhimrsw} elect leader, _BECOME_MASTER_TASK_, _FINISH_ELECTION_], term: 17, version: 33, delta: master node changed {previous [], current [{sonarqube}{Y6fJpjtoQCaCNWVU2AVCgA}{am95DKU>
2022.07.08 11:59:37 INFO  es[][o.e.c.s.ClusterApplierService] master node changed {previous [], current [{sonarqube}{Y6fJpjtoQCaCNWVU2AVCgA}{am95DKUUTna8Z3s46NEAeQ}{127.0.0.1}{127.0.0.1:40629}{cdfhimrsw}]}, term: 17, version: 33, reason: Publication{term=17, version=33}
2022.07.08 11:59:37 INFO  es[][o.e.h.AbstractHttpServerTransport] publish_address {127.0.0.1:9001}, bound_addresses {127.0.0.1:9001}
2022.07.08 11:59:37 INFO  es[][o.e.n.Node] started

sonar.log

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

2022.07.08 11:58:38 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp
2022.07.08 11:58:38 INFO  app[][o.s.a.es.EsSettings] Elasticsearch listening on [HTTP: 127.0.0.1:9001, TCP: 127.0.0.1:43997]
2022.07.08 11:58:38 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[ELASTICSEARCH] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch
2022.07.08 11:58:38 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2022.07.08 11:58:45 INFO  app[][o.s.a.SchedulerImpl] Process[es] is up
2022.07.08 11:58:45 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[WEB_SERVER] from [/opt/sonarqube]: /usr/lib/jvm/java-11-openjdk-amd64/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->
2022.07.08 11:59:27 INFO  app[][o.s.a.SchedulerImpl] Process[Web Server] is stopped
2022.07.08 11:59:27 WARN  app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [ElasticSearch]: 143
2022.07.08 11:59:27 INFO  app[][o.s.a.SchedulerImpl] Process[ElasticSearch] is stopped
2022.07.08 11:59:27 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.

2022.07.08 11:59:30 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp
2022.07.08 11:59:30 INFO  app[][o.s.a.es.EsSettings] Elasticsearch listening on [HTTP: 127.0.0.1:9001, TCP: 127.0.0.1:40629]
2022.07.08 11:59:30 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[ELASTICSEARCH] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch
2022.07.08 11:59:30 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2022.07.08 11:59:37 INFO  app[][o.s.a.SchedulerImpl] Process[es] is up
2022.07.08 11:59:37 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[WEB_SERVER] from [/opt/sonarqube]: /usr/lib/jvm/java-11-openjdk-amd64/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->

sonar.properties
sonar.jdbc.username=sonar
sonar.jdbc.password={password}
sonar.jbdc.url=jdbc:postgresql://{IP}:5432/sonarqube

I’ve checked 20 times that my credentials are properly setup. Also tried logging in with my credentials through TablePlus, which worked fine.

I am a bit concerned it might be my VPS capabilities, so I’ll also post my server stats:

SonarQube
2 GB RAM
40 GB SSD

PostgreSQL
1 GB RAM
20 GB SSD

I am currently looking to upgrade the disk space on my database server, as I understand that might fill out very quickly.

Is the database credential error a generic error which is putting me off trail, or is it simply credential setup issue?

Hi,

Welcome to the community!

There are a couple clues in your logs, but they’re pretty subtle:

The important parts here are Embedded, start and org.h2.

All of these tell me SonarQube isn’t trying to connect to your Postgres DB, but is trying to start the not-for-production, eval-only, embedded H2 DB. Why would it be trying to do that? I’m going to guess it doesn’t see the configuration for your Postgres DB. If this weren’t a Docker deployment, I’d say you failed to un-comment the Postgres JDBC URL setting in sonar.conf. In a Docker context, I guess the envvar isn’t set correctly (typo in the name?). The docs should help.

 
Ann

sonar.jbdc.url=jdbc:postgresql://{IP}:5432/sonarqube

=>

sonar.jdbc.url=jdbc:postgresql://{IP}:5432/sonarqube

And now it works - I will never disclose how long I spent before finding this.

Thanks for helping me focus on the sonar.properties file read =)

I don’t… see… a difference…?

 
Ann

sonar.jbdc => sonar.jdbc

1 Like

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