Caused by: org.postgresql.util.PSQLException: ERROR: relation "schema_migrations" does not exist Position: 21

i just upgraded my psql from 9x to 10x after db upgrade i am getting this error ,can anyone help?

coding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&autoReconnect=true
2020.05.04 21:23:57 INFO web[o.s.s.p.ServerFileSystemImpl] SonarQube home: /opt/sonar
2020.05.04 21:23:57 INFO web[o.s.s.u.SystemPasscodeImpl] System authentication by passcode is disabled
2020.05.04 21:23:57 ERROR web[o.s.s.p.PlatformImpl] Web server startup failed
java.lang.IllegalStateException: Failed to read content of table schema_migrations
at org.sonar.server.platform.db.migration.history.MigrationHistoryImpl.getLastMigrationNumber(MigrationHistoryImpl.java:75)
at org.sonar.server.platform.db.migration.history.MigrationHistoryMeddler.meddle(MigrationHistoryMeddler.java:45)
at org.sonar.server.platform.db.migration.history.MigrationHistoryImpl.start(MigrationHistoryImpl.java:54)
at org.sonar.core.platform.StartableCloseableSafeLifecyleStrategy.start(StartableCloseableSafeLifecyleStrategy.java:42)
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)

Hi,

Welcome to the community!

When we see errors like this it always ends up being something like the DB URL isn’t pointed to the correct schema. These threads might help:

 
HTH,
Ann

Hi Ann,
Thanks for writing , i am getting below errors after correcting the URL string . could you please help me to understand how to fetch DB string from DB.

2020.05.05 19:54:44 INFO  web[][o.s.s.p.ServerFileSystemImpl] SonarQube home: /opt/sonar
2020.05.05 19:54:44 INFO  web[][o.s.s.u.SystemPasscodeImpl] System authentication by passcode is disabled
2020.05.05 19:54:44 ERROR web[][o.s.s.p.PlatformImpl] Web server startup failed
java.lang.IllegalStateException: Failed to read content of table schema_migrations
        at org.sonar.server.platform.db.migration.history.MigrationHistoryImpl.getLastMigrationNumber(MigrationHistoryImpl.java:75)
        at org.sonar.server.platform.db.migration.history.MigrationHistoryMeddler.meddle(MigrationHistoryMeddler.java:45)
        at org.sonar.server.platform.db.migration.history.MigrationHistoryImpl.start(MigrationHistoryImpl.java:54)
        at org.sonar.core.platform.StartableCloseableSafeLifecyleStrategy.start(StartableCloseableSafeLifecyleStrategy.java:42)
        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.platformlevel.PlatformLevel2.start(PlatformLevel2.java:107)
        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: relation "schema_migrations" does not exist
  Position: 21
        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.executeQuery(PgStatement.java:225)
        at org.apache.commons.dbcp2.DelegatingStatement.executeQuery(DelegatingStatement.java:329)
        at org.apache.commons.dbcp2.DelegatingStatement.executeQuery(DelegatingStatement.java:329)
        at org.sonar.server.platform.db.migration.history.MigrationHistoryImpl.selectVersions(MigrationHistoryImpl.java:97)
        at org.sonar.server.platform.db.migration.history.MigrationHistoryImpl.getLastMigrationNumber(MigrationHistoryImpl.java:68)
        ... 26 common frames omitted
2020.05.05 19:54:44 INFO  web[][o.s.s.a.EmbeddedTomcat] HTTP connector enabled on port 9000
2020.05.05 19:54:44 INFO  web[][o.s.p.ProcessEntryPoint] Hard stopping process

Hi,

Your error indicates to me that you’re still not connecting (correctly?) to the SonarQube db/schema:

 
Ann

Hi but connection was same as it was before db upgrade .after upgrade this issue arrise , i hve not changed anything in configurations.

Hi,

Sorry, I guess I read too fast. I see that you upgraded the DB engine, not SonarQube, right?

I’m still gonna have to go with a problem properly connecting to the db/schema. Maybe the URL should have changed after the upgrade? Maybe the upgrade “helpfully” changed some user attributes…? It’s difficult for me to diagnose this, but the error tells me that when SonarQube reaches out to its DB, it doesn’t like what it finds.

 
:woman_shrugging:
Ann