SonarQube Server 8.9.10 → 9.9 LTA Upgrade Failure: “Migration history table is missing”

Hello everyone,

I have successfully upgraded my SonarQube Server instance from v8.6.1 to v8.9.10 Developer Edition.
During this upgrade, both the database migration and Elasticsearch reindexing processes completed successfully without any issues.

Below are the current environment details:

Component Version / Details
SonarQube Edition Developer Edition
SonarQube Version 8.9.10
Database Oracle Database 19c
JDBC Driver ojdbc10
JDK Oracle JDK 11

When attempting to upgrade from SonarQube v8.9.10 to v9.9 Long-Term Support (LTA), the database schema migration process fails with the following error:

Migration history table is missing

Full log trace is provided below:

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@5ffd2b27-org.sonar.server.platform.db.migration.history.MigrationHistoryImpl': Initialization of bean failed; nested exception is java.lang.IllegalStateException: Migration history table is missing
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@5ffd2b27-org.sonar.server.platform.db.migration.history.MigrationHistoryImpl': Initialization of bean failed; nested exception is java.lang.IllegalStateException: Migration history table is missing
        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:955)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:920)
        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.PlatformLevel2.start(PlatformLevel2.java:103)
        at org.sonar.server.platform.PlatformImpl.start(PlatformImpl.java:196)
        at org.sonar.server.platform.PlatformImpl.startLevel2Container(PlatformImpl.java:169)
        at org.sonar.server.platform.PlatformImpl.init(PlatformImpl.java:77)
        at org.sonar.server.platform.web.PlatformServletContextListener.contextInitialized(PlatformServletContextListener.java:43)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4005)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4446)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:164)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1203)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1193)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
        at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:749)
        at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:721)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:164)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1203)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1193)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
        at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:749)
        at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:211)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:164)
        at org.apache.catalina.core.StandardService.startInternal(StandardService.java:415)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:164)
        at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:874)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:164)
        at org.apache.catalina.startup.Tomcat.start(Tomcat.java:438)
        at org.sonar.server.app.EmbeddedTomcat.start(EmbeddedTomcat.java:72)
        at org.sonar.server.app.WebServer.start(WebServer.java:55)
        at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:97)
        at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:81)
        at org.sonar.server.app.WebServer.main(WebServer.java:104)
Caused by: java.lang.IllegalStateException: Migration history table is missing
        at com.google.common.base.Preconditions.checkState(Preconditions.java:502)
        at org.sonar.server.platform.db.migration.history.MigrationHistoryImpl.start(MigrationHistoryImpl.java:53)
        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)
        ... 44 common frames omitted
INFO  web[][c.z.h.HikariDataSource] HikariPool-1 - Shutdown initiated...
INFO  web[][c.z.h.HikariDataSource] HikariPool-1 - Shutdown completed.
  • Has anyone encountered this specific error when upgrading from 8.9.10 to 9.9 LTA?
  • Are there any recommended steps to rebuild or re-initialize the migration history before retrying the upgrade?
  • Are similar issues expected in upcoming versions (e.g., 2025.1 or 2025.5)?

Thank you :slight_smile:

Hi,

Welcome to the community!

It sounds like your DB got borked. I suggest you restore your last good backup and restart the migration process.

 
HTH,
Ann

Hi Ann,

Thank you for your kind response.

I just tried restoring last healthy db state and trying to start migration but it didnot worked for me.
Then I found that there was no migration history table even before first upgrade step.
Also creating migration history table with correct permissions for sonar user is not a solution.

I think it is all about the schema changes.

Hi,

You’re going to need to go backward in your backup library until you find a good state, i.e. until you find a backup where the table exists. Because the only changes we ever make to that table is to update its contents.

I’m sorry I don’t have an easier answer for you.

 
:frowning:
Ann

1 Like