SonarQube service is getting stopped as soon as it starts

Hi Team,

I am trying to setup fresh SonarQube on Kubernetes platform and getting some errors.
SonarQube version being used: 7.9.4
DB used: AWS RDS (PostgreSQL- Engine Version: 12.5)

As per pod logs, I am getting below error after creating fresh PostgreSQL DB :slight_smile:

2021.05.06 07:01:14 ERROR web[][o.s.s.p.Platform] Web server startup failed: Current version is too old. Please upgrade to Long Term Support version firstly.

Google searches suggest that this error would appear when you try to upgrade sonar versions. But I am trying to set fresh setup, not any upgrades.
However, I came across below article that suggests that table named “schema_migrations” shouldn’t contain any data.
As I checked on DB, I was getting some data for this table.
Hence I deleted everything from this table.

SONAR=> SELECT * FROM schema_migrations;

version

---------

1

2

1153

1200

1205

1207

1208

1209

1210

1211

1212

1213

1214

1215

1216

1217

1218

1219

1220

1221

1222

1223

1224

(23 rows)

SONAR=>

SONAR=> DELETE FROM schema_migrations;

DELETE 23

SONAR=> SELECT * FROM schema_migrations;

version

---------

(0 rows)

I deleted the pod and created new pod again and I am getting errors as below:

2021.05.06 08:20:52 ERROR web[][DbMigrations] #1 'Create initial schema': failure | time=271ms
2021.05.06 08:20:52 ERROR web[][DbMigrations] Executed DB migrations: failure | time=272ms
2021.05.06 08:20:52 ERROR web[][o.s.s.p.Platform] Web server startup failed
 org.sonar.server.platform.db.migration.step.MigrationStepExecutionException: Execution of migration step #1 'Create initial schema' failed

    at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:79)

    at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:67)

    at java.base/java.lang.Iterable.forEach(Unknown Source)

    at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:52)

    at org.sonar.server.platform.db.migration.engine.MigrationEngineImpl.execute(MigrationEngineImpl.java:68)

    at org.sonar.server.platform.db.migration.AutoDbMigration.start(AutoDbMigration.java:121)

    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.Platform.start(Platform.java:211)

    at org.sonar.server.platform.Platform.startSafeModeContainer(Platform.java:203)

    at org.sonar.server.platform.Platform.doStart(Platform.java:104)

    at org.sonar.server.platform.Platform.doStart(Platform.java:95)

    at org.sonar.server.platform.web.PlatformServletContextListener.contextInitialized(PlatformServletContextListener.java:44)

    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(Unknown Source)

    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

    at java.base/java.lang.Thread.run(Unknown Source)

Caused by: java.lang.IllegalStateException: Fail to execute CREATE TABLE active_dashboards (id SERIAL NOT NULL,dashboard_id INTEGER NOT NULL,user_id INTEGER NULL,order_index INTEGER NULL, CONSTRAINT pk_active_dashboards PRIMARY KEY (id))

    at org.sonar.server.platform.db.migration.step.DdlChange$Context.execute(DdlChange.java:97)

    at org.sonar.server.platform.db.migration.step.DdlChange$Context.execute(DdlChange.java:77)

    at org.sonar.server.platform.db.migration.step.DdlChange$Context.execute(DdlChange.java:117)

    at org.sonar.server.platform.db.migration.version.v56.CreateInitialSchema.createActiveDashboards(CreateInitialSchema.java:512)

    at org.sonar.server.platform.db.migration.version.v56.CreateInitialSchema.execute(CreateInitialSchema.java:51)

    at org.sonar.server.platform.db.migration.step.DdlChange.execute(DdlChange.java:45)

    at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:75)

    ... 29 common frames omitted

    Caused by: org.postgresql.util.PSQLException: ERROR: relation "active_dashboards" already exists

    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.step.DdlChange$Context.execute(DdlChange.java:82)

    ... 35 common frames omitted

Can anyone please help me to resolve the issue ?

Thanks,
Vaibhav Jariwala

Hi Vaibhav,

If you truly want a brand new instance, then start with an empty schema. SonarQube will take it from there.

 
:slight_smile:
Ann

Hi @ganncamp ,
Thanks for sparing time and responding to my query.

I have deleted all schemas and ensured DB is empty and then started pod again.
I am still getting the same error as below:

2021.05.07 05:01:00 ERROR web[][o.s.s.p.Platform] Web server startup failed: Current version is too old. Please upgrade to Long Term Support version firstly.

I’m not sure if the error you are seeing refers to the version of the SonarQube server. However, version 7.9.4 is an LTS version from July '20; the latest 7.9 LTS version is 7.9.6 from March '21. The most recent LTS version is 8.9 which was released just this week.
Any specific reason why you are using 7.9.4 instead of 7.9.6 or 8.9? What happens if you use one of those versions (preferrably 8.9)?

Hi,

I have tried to setup stack using latest sonarqube version: 8.9:community
I am still getting the same error as below:

2021.05.07 11:34:07 INFO  web[][o.s.s.p.LogServerVersion] SonarQube Server / 8.9.0.43852 / 681d1975f698b70fc4e981593f7bed298ff2f60d
2021.05.07 11:34:07 INFO  web[][o.sonar.db.Database] Create JDBC data source for jdbc:postgresql://sonar-test.ctzksopipr55.us-east-1.rds.amazonaws.com:5432/SONAR
2021.05.07 11:34:10 INFO  web[][o.s.s.p.ServerFileSystemImpl] SonarQube home: /opt/sonarqube
2021.05.07 11:34:10 INFO  web[][o.s.s.u.SystemPasscodeImpl] System authentication by passcode is disabled
2021.05.07 11:34:12 ERROR web[][o.s.s.p.PlatformImpl] Web server startup failed: Current version is too old. Please upgrade to Long Term Support version firstly.

I am using AWS RDS PostgreSQL with engine version: 11.1 as it is compatible with sonarqube 8.9 version.

Hi,

That error indicates that you’re connecting to a SonarQube schema which is from a version of SonarQube older than 7.9. You are not connecting to a blank/empty schema, which is required to start up a brand new instance.

 
Ann

I have used brand new RDS instance only. Actually, tried twice by creating new RDS and used the same.
I am still getting error.

Even I cross verified that nothing was resent in DB after RDS created.
No tables were there.
I created stack and observed many tables got created during sonarqube installation.
Not sure, why I am getting the LTS error when I am using new RDS every time.