Sonarqube not starting ERROR: no schema has been selected to create in

  • which versions are you using (SonarQube 9.3.0.51899)
  • what are you trying to achieve - Starting the server
2022.03.15 14:07:49 INFO  web[][o.s.p.ProcessEntryPoint] Starting web
2022.03.15 14:07:49 INFO  web[][o.a.t.u.n.NioSelectorPool] Using a shared selector for servlet write/read
2022.03.15 14:07:50 INFO  web[][o.s.s.e.EsClientProvider] Connected to local Elasticsearch: [http://127.0.0.1:9001]
2022.03.15 14:07:51 INFO  web[][o.s.s.p.LogServerVersion] SonarQube Server / 9.3.0.51899 / 1a276267d04cd4df862d57201082413946b6b3fa
2022.03.15 14:07:51 INFO  web[][o.sonar.db.Database] Create JDBC data source for jdbc:postgresql://10.96.99.195:5432/sonarqube
2022.03.15 14:07:52 INFO  web[][o.s.s.p.ServerFileSystemImpl] SonarQube home: C:\sonarqube-9.3.0.51899
2022.03.15 14:07:52 INFO  web[][o.s.s.u.SystemPasscodeImpl] System authentication by passcode is disabled
2022.03.15 14:07:52 INFO  web[][o.s.s.p.d.m.h.MigrationHistoryTableImpl] Creating table schema_migrations
2022.03.15 14:07:52 ERROR web[][o.s.s.p.PlatformImpl] Web server startup failed
java.lang.IllegalStateException: Failed to create table schema_migrations
	at org.sonar.server.platform.db.migration.history.MigrationHistoryTableImpl.start(MigrationHistoryTableImpl.java:48)
	at java.base/java.util.Optional.ifPresent(Optional.java:178)
	at org.sonar.server.platform.platformlevel.PlatformLevel2.start(PlatformLevel2.java:105)
	at org.sonar.server.platform.PlatformImpl.start(PlatformImpl.java:213)
	at org.sonar.server.platform.PlatformImpl.startLevel2Container(PlatformImpl.java:179)
	at org.sonar.server.platform.PlatformImpl.init(PlatformImpl.java:87)
	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:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: org.postgresql.util.PSQLException: ERROR: no schema has been selected to create in
  Position: 14
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2674)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2364)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:354)
	at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:484)
	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:404)
	at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:325)
	at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:311)
	at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:287)
	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:282)
	at org.apache.commons.dbcp2.DelegatingStatement.execute(DelegatingStatement.java:193)
	at org.apache.commons.dbcp2.DelegatingStatement.execute(DelegatingStatement.java:193)
	at org.sonar.server.platform.db.migration.history.MigrationHistoryTableImpl.execute(MigrationHistoryTableImpl.java:71)
	at org.sonar.server.platform.db.migration.history.MigrationHistoryTableImpl.createTable(MigrationHistoryTableImpl.java:59)
	at org.sonar.server.platform.db.migration.history.MigrationHistoryTableImpl.start(MigrationHistoryTableImpl.java:45)
	... 15 common frames omitted
2022.03.15 14:07:53 INFO  web[][o.s.s.a.EmbeddedTomcat] HTTP connector enabled on port 9000
2022.03.15 14:07:53 INFO  web[][o.s.p.ProcessEntryPoint] Hard stopping process

sonar.properties

# The schema must be created first.
sonar.jdbc.username=sonar
sonar.jdbc.password=admin

#----- Embedded Database (default)
# H2 embedded database server listening port, defaults to 9092
#sonar.embeddedDatabase.port=9092


#----- Oracle 12c/18c/19c
# The Oracle JDBC driver must be copied into the directory extensions/jdbc-driver/oracle/.
# Only the thin client is supported, and we recommend using the latest Oracle JDBC driver. See
# https://jira.sonarsource.com/browse/SONAR-9758 for more details.
# If you need to set the schema, please refer to http://jira.sonarsource.com/browse/SONAR-5000
#sonar.jdbc.url=jdbc:oracle:thin:@localhost:1521/XE


#----- PostgreSQL 9.6 or greater
# By default the schema named "public" is used. It can be overridden with the parameter "currentSchema".
sonar.jdbc.url=jdbc:postgresql://10.96.99.xxx:5432/sonarqube

es.log

2022.03.15 14:07:36 INFO  es[][o.e.n.Node] JVM home [C:\Program Files\Java\jdk-17.0.2]
2022.03.15 14:07:36 INFO  es[][o.e.n.Node] JVM arguments [-XX:+UseG1GC, -Djava.io.tmpdir=C:\sonarqube-9.3.0.51899\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=C:\sonarqube-9.3.0.51899\temp, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dio.netty.allocator.numDirectArenas=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Dlog4j2.formatMsgNoLookups=true, -Djava.locale.providers=COMPAT, -Dcom.redhat.fips=false, -Des.enforce.bootstrap.checks=true, -Xmx512m, -Xms512m, -XX:MaxDirectMemorySize=256m, -XX:+HeapDumpOnOutOfMemoryError, -Delasticsearch, -Des.path.home=C:\sonarqube-9.3.0.51899\elasticsearch, -Des.path.conf=C:\sonarqube-9.3.0.51899\temp\conf\es]
2022.03.15 14:07:37 INFO  es[][o.e.p.PluginsService] loaded module [analysis-common]
2022.03.15 14:07:37 INFO  es[][o.e.p.PluginsService] loaded module [lang-painless]
2022.03.15 14:07:37 INFO  es[][o.e.p.PluginsService] loaded module [parent-join]
2022.03.15 14:07:37 INFO  es[][o.e.p.PluginsService] loaded module [transport-netty4]
2022.03.15 14:07:37 INFO  es[][o.e.p.PluginsService] no plugins loaded
2022.03.15 14:07:37 INFO  es[][o.e.e.NodeEnvironment] using [1] data paths, mounts [[(C:)]], net usable_space [79.9gb], net total_space [99.4gb], types [NTFS]
2022.03.15 14:07:37 INFO  es[][o.e.e.NodeEnvironment] heap size [512mb], compressed ordinary object pointers [true]
2022.03.15 14:07:37 INFO  es[][o.e.n.Node] node name [sonarqube], node ID [avDwRisXRXCKXKUnTWbQsQ], cluster name [sonarqube], roles [data_frozen, master, remote_cluster_client, data, data_content, data_hot, data_warm, data_cold, ingest]
2022.03.15 14:07:41 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.03.15 14:07:41 INFO  es[][o.e.d.DiscoveryModule] using discovery type [zen] and seed hosts providers [settings]
2022.03.15 14:07:42 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.03.15 14:07:42 INFO  es[][o.e.n.Node] initialized
2022.03.15 14:07:42 INFO  es[][o.e.n.Node] starting ...
2022.03.15 14:07:42 INFO  es[][o.e.t.TransportService] publish_address {127.0.0.1:51627}, bound_addresses {127.0.0.1:51627}
2022.03.15 14:07:43 INFO  es[][o.e.b.BootstrapChecks] explicitly enforcing bootstrap checks
2022.03.15 14:07:43 INFO  es[][o.e.c.c.Coordinator] cluster UUID [-QEg_pRGTrmPJTtVbDQBEQ]
2022.03.15 14:07:43 INFO  es[][o.e.c.s.MasterService] elected-as-master ([1] nodes joined)[{sonarqube}{avDwRisXRXCKXKUnTWbQsQ}{LKGE1nEoSp-4QP--hkSLZw}{127.0.0.1}{127.0.0.1:51627}{cdfhimrsw} elect leader, _BECOME_MASTER_TASK_, _FINISH_ELECTION_], term: 22, version: 413, delta: master node changed {previous [], current [{sonarqube}{avDwRisXRXCKXKUnTWbQsQ}{LKGE1nEoSp-4QP--hkSLZw}{127.0.0.1}{127.0.0.1:51627}{cdfhimrsw}]}
2022.03.15 14:07:43 INFO  es[][o.e.c.s.ClusterApplierService] master node changed {previous [], current [{sonarqube}{avDwRisXRXCKXKUnTWbQsQ}{LKGE1nEoSp-4QP--hkSLZw}{127.0.0.1}{127.0.0.1:51627}{cdfhimrsw}]}, term: 22, version: 413, reason: Publication{term=22, version=413}
2022.03.15 14:07:43 INFO  es[][o.e.h.AbstractHttpServerTransport] publish_address {127.0.0.1:9001}, bound_addresses {127.0.0.1:9001}
2022.03.15 14:07:43 INFO  es[][o.e.n.Node] started
2022.03.15 14:07:43 INFO  es[][o.e.g.GatewayService] recovered [7] indices into cluster_state
2022.03.15 14:07:48 INFO  es[][o.e.c.r.a.AllocationService] Cluster health status changed from [RED] to [GREEN] (reason: [shards started [[components][2], [components][1], [components][0]]]).

Hi,

Welcome to the community!

I want to start by confirming that you’ve already changed that DB account password you just published. :slight_smile:

Going by the error, it looks like maybe that comment in the sonar.properties file is wrong (or maybe no longer correct, even if it used to be). Have you tried adding back the ?currentSchema=[schema name] that’s in that setting by default?

 
Ann