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
Must-share information (formatted with Markdown):
Hi,
Welcome to the community!
You havenāt given us much to go on here. Before anyone can help you youāre going to need to provide more details.
Ā
Ann
Hello. I have somnarcube connected to a AWS Postgres Aurora Cluster. The user I created for the database has superuser permissions. I am able to connect to the RDS from my server. I set up the config file as such.
sonar.jdbc.url=jdbc:postgresql://xxxxxxxx-xxxxxxx-xxxxxx-xxxxxxx:5432/sonarqube?
I get this error below in the web.log
2019.09.09 09:28:33 INFO web[o.s.s.p.d.m.h.MigrationHistoryTableImpl] Creating table schema_migrations
2019.09.09 09:28:33 ERROR web[o.s.s.p.Platform] Web server startup failed
java.lang.IllegalStateException: Failed to create table schema_migrations
Hi,
Take a look at this post & see if it helps:
Ann
Talked to my DBA. HE said he created the table. Still getting the same error. Here are the log files sonar.log
Launching a JVM...
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved.
2019.09.12 15:22:58 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonar/temp
2019.09.12 15:22:58 INFO app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
2019.09.12 15:22:58 INFO app[][o.s.a.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonar/elasticsearch]: /opt/sonar/elasticsearch/bin/elasticsearch
2019.09.12 15:22:58 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.
2019.09.12 15:22:59 INFO app[][o.e.p.PluginsService] no modules loaded
2019.09.12 15:22:59 INFO app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
2019.09.12 15:23:11 INFO app[][o.s.a.SchedulerImpl] Process[es] is up
2019.09.12 15:23:11 INFO app[][o.s.a.ProcessLauncherImpl] Launch process[[key='web', ipcIndex=2, logFilenamePrefix=web]] from [/opt/sonar]: /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/sonar/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 -Xmx1G -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Dhttp.nonProxyHosts=localhost|127.*|[::1] -cp ./lib/common/*:/opt/sonar/lib/jdbc/postgresql/postgresql-42.2.5.jar org.sonar.server.app.WebServer /opt/sonar/temp/sq-process3413622168226531192properties
2019.09.12 15:23:18 INFO app[][o.s.a.SchedulerImpl] Process[web] is stopped
2019.09.12 15:23:18 WARN app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 143
2019.09.12 15:23:18 INFO app[][o.s.a.SchedulerImpl] Process[es] is stopped
2019.09.12 15:23:18 INFO app[][o.s.a.SchedulerImpl] SonarQube is stopped
<-- Wrapper Stopped
Here are the web.log logs.
2019.09.12 15:22:02 INFO web[][o.s.p.ProcessEntryPoint] Starting web
2019.09.12 15:22:02 INFO web[][o.a.t.u.n.NioSelectorPool] Using a shared selector for servlet write/read
2019.09.12 15:22:03 INFO web[][o.s.c.e.CoreExtensionsLoader] Loaded core extensions: enterprise-edition, ce-workers, developer-scanner, developer-server, governance, license, securityreport
2019.09.12 15:22:03 INFO web[][o.e.p.PluginsService] no modules loaded
2019.09.12 15:22:03 INFO web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.join.ParentJoinPlugin]
2019.09.12 15:22:03 INFO web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.percolator.PercolatorPlugin]
2019.09.12 15:22:03 INFO web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
2019.09.12 15:22:05 INFO web[][o.s.s.e.EsClientProvider] Connected to local Elasticsearch: [127.0.0.1:9001]
2019.09.12 15:22:05 INFO web[][o.s.s.p.LogServerVersion] SonarQube Server / 7.9.1.27448 / e0c45c97bb2e45d52629f3422ac91718020f6db9
2019.09.12 15:22:05 INFO web[][o.sonar.db.Database] Create JDBC data source for jdbc:postgresql://sharedpostgresdb-cluster-test.cluster-ro-cjopepouww6r.us-east-1.rds.amazonaws.com:5432/sonarqube?
2019.09.12 15:22:07 INFO web[][o.s.s.p.ServerFileSystemImpl] SonarQube home: /opt/sonar
2019.09.12 15:22:07 INFO web[][o.s.s.u.SystemPasscodeImpl] System authentication by passcode is disabled
2019.09.12 15:22:07 INFO web[][o.s.s.p.d.m.h.MigrationHistoryTableImpl] Creating table schema_migrations
2019.09.12 15:22:07 ERROR web[][o.s.s.p.Platform] 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:183)
at org.sonar.server.platform.platformlevel.PlatformLevel2.start(PlatformLevel2.java:107)
at org.sonar.server.platform.Platform.start(Platform.java:211)
at org.sonar.server.platform.Platform.startLevel2Container(Platform.java:177)
at org.sonar.server.platform.Platform.init(Platform.java:87)
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: org.postgresql.util.PSQLException: ERROR: cannot execute CREATE TABLE in a read-only transaction
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2440)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2183)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:308)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:441)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:365)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:307)
at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:293)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:270)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:266)
at org.apache.commons.dbcp2.DelegatingStatement.execute(DelegatingStatement.java:175)
at org.apache.commons.dbcp2.DelegatingStatement.execute(DelegatingStatement.java:175)
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
2019.09.12 15:22:08 INFO web[][o.s.s.a.EmbeddedTomcat] HTTP connector enabled on port 9003
2019.09.12 15:22:08 INFO web[][o.s.p.ProcessEntryPoint] Hard stopping process
2019.09.12 15:23:12 INFO web[][o.s.p.ProcessEntryPoint] Starting web
2019.09.12 15:23:13 INFO web[][o.a.t.u.n.NioSelectorPool] Using a shared selector for servlet write/read
2019.09.12 15:23:13 INFO web[][o.s.c.e.CoreExtensionsLoader] Loaded core extensions: enterprise-edition, ce-workers, developer-scanner, developer-server, governance, license, securityreport
2019.09.12 15:23:14 INFO web[][o.e.p.PluginsService] no modules loaded
2019.09.12 15:23:14 INFO web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.join.ParentJoinPlugin]
2019.09.12 15:23:14 INFO web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.percolator.PercolatorPlugin]
2019.09.12 15:23:14 INFO web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
2019.09.12 15:23:15 INFO web[][o.s.s.e.EsClientProvider] Connected to local Elasticsearch: [127.0.0.1:9001]
2019.09.12 15:23:15 INFO web[][o.s.s.p.LogServerVersion] SonarQube Server / 7.9.1.27448 / e0c45c97bb2e45d52629f3422ac91718020f6db9
2019.09.12 15:23:15 INFO web[][o.sonar.db.Database] Create JDBC data source for jdbc:postgresql://sharedpostgresdb-cluster-test.cluster-ro-cjopepouww6r.us-east-1.rds.amazonaws.com:5432/sonarqube?
2019.09.12 15:23:17 INFO web[][o.s.s.p.ServerFileSystemImpl] SonarQube home: /opt/sonar
2019.09.12 15:23:17 INFO web[][o.s.s.u.SystemPasscodeImpl] System authentication by passcode is disabled
2019.09.12 15:23:17 INFO web[][o.s.s.p.d.m.h.MigrationHistoryTableImpl] Creating table schema_migrations
2019.09.12 15:23:17 ERROR web[][o.s.s.p.Platform] 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:183)
at org.sonar.server.platform.platformlevel.PlatformLevel2.start(PlatformLevel2.java:107)
at org.sonar.server.platform.Platform.start(Platform.java:211)
at org.sonar.server.platform.Platform.startLevel2Container(Platform.java:177)
at org.sonar.server.platform.Platform.init(Platform.java:87)
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: org.postgresql.util.PSQLException: ERROR: cannot execute CREATE TABLE in a read-only transaction
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2440)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2183)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:308)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:441)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:365)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:307)
at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:293)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:270)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:266)
at org.apache.commons.dbcp2.DelegatingStatement.execute(DelegatingStatement.java:175)
at org.apache.commons.dbcp2.DelegatingStatement.execute(DelegatingStatement.java:175)
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
2019.09.12 15:23:18 INFO web[][o.s.s.a.EmbeddedTomcat] HTTP connector enabled on port 9003
2019.09.12 15:23:18 INFO web[][o.s.p.ProcessEntryPoint] Hard stopping process
Hi,
This seems to be your problem:
Iām not sure how you got into a āread-only transactionā state. SonarQube doesnāt put itself there. You probably need to investigate this permissioning with your DBA.
Good luck!
Ann
Thanks. I am working with the DBA. He said he turned the read-only transaction to off. Where do you set the PostgreSQL search_path
.
"ALTER USER mySonarUser SET search_path to mySonarQubeSchema"
This may be causing the issue.
Hi,
All I know is that the SonarQube user needs all rights on its schema.
Ā
Ann
Sonarqube user has all rights on its schema. Here are my sonar.properties configurations.
sonar.jdbc.username= sonaruser
sonar.jdbc.password= xxxxxxxxx
#----- PostgreSQL 9.3 or greater
sonar.jdbc.url=jdbc:postgresql://sharedxxxxxxx-cluster-test.cluster-roxxxxxxxxxx.us-east-1.rds.amazonaws.com:5432/sonarqube
user āsonaruserā has all rights on its schema.
Same result. Is this the correct way to configure this line if I am using the current schema?
sonar.jdbc.url=jdbc:postgresql://sharedxxxxxxx-cluster-test.cluster-roxxxxxxxxxx.us-east-1.rds.amazonaws.com:5432/sonarqube
Thanks. We got it figured out. Had to change the rds url to the writer and not the cluster url. It worked after that.
Hi
I have a similar issue and the version what we have installed is PostgreSQL is 11.X and when we try to start the sonar cube itās giving me the below error. I verified with our DBA team and they have granted all sorts of permission for accessing and write on the database. Can you help me on resolving the issue.
Sonar cube version is : sonarqube-8.1.0.31237
2019.12.31 17:34:24 INFO web[o.s.s.p.LogServerVersion] SonarQube Server / 8.1.0.31237 / 492562ade8941108d7bd281ea9c1cebcf0c1fce3
2019.12.31 17:34:24 INFO web[o.sonar.db.Database] Create JDBC data source for jdbc:postgresql://XXXXXX:5432/sonarqube?currentSchema=sonarqube
2019.12.31 17:34:29 INFO web[o.s.s.p.ServerFileSystemImpl] SonarQube home: D:\Softwares\Cube\sonarqube-8.1.0.31237
2019.12.31 17:34:29 INFO web[o.s.s.u.SystemPasscodeImpl] System authentication by passcode is disabled
2019.12.31 17:34:31 INFO web[o.s.s.p.d.m.h.MigrationHistoryTableImpl] Creating table schema_migrations
2019.12.31 17:34:31 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:183)
at org.sonar.server.platform.platformlevel.PlatformLevel2.start(PlatformLevel2.java:101)
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:4770)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5236)
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: org.postgresql.util.PSQLException: ERROR: no schema has been selected to create in
Position: 14
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2497)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2233)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:310)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:446)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:370)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:311)
at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:297)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:274)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:269)
at org.apache.commons.dbcp2.DelegatingStatement.execute(DelegatingStatement.java:194)
at org.apache.commons.dbcp2.DelegatingStatement.execute(DelegatingStatement.java:194)
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
2019.12.31 17:34:33 WARN web[o.a.c.u.SessionIdGeneratorBase] Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [145] milliseconds.
2019.12.31 17:34:33 INFO web[o.s.s.a.EmbeddedTomcat] HTTP connector enabled on port 9005
2019.12.31 17:34:33 INFO web[o.s.p.ProcessEntryPoint] Hard stopping process
Hello raghu. Are you using an Aurora RDS ?
Hi,
Iām no Postgres expert, but Iām guessing this is about your connection URL not having a schema in itā¦?
Ann