DB issue in upgrading sonarqube from 9.6 to 9.9 LTS

We are currently at Sonarqube enterprise version 9.6 and are working on upgrading it to Sonarqube enterprise 9.9 LTS in staging environment.

Database type we are using is postgresql.

Below mentioned is the error I am getting when I try upgrade to 9.9 LTS version. Please let me know what is the root cause of issue and what can be done to fix it.


2023.05.02 04:27:32 INFO  web[][o.s.s.p.UpdateCenterClient] Update center: https://update.sonarsource.org/update-center.properties (no proxy)
2023.05.02 04:27:35 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action saml/validation_init
2023.05.02 04:27:35 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/system/liveness
2023.05.02 04:27:35 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/plugins/download
2023.05.02 04:27:35 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/analysis_cache/get
2023.05.02 04:27:35 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/alm_integrations/check_pat
2023.05.02 04:27:35 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/push/sonarlint_events
2023.05.02 04:27:35 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/security_reports/download
2023.05.02 04:27:35 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/views/definition
2023.05.02 04:27:35 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/regulatory_reports/download
2023.05.02 04:27:35 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/governance_reports/download
2023.05.02 04:27:35 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/support/info
2023.05.02 04:27:35 INFO  web[][o.s.s.a.p.ExpiredSessionsCleaner] Purge of expired session tokens has removed 0 elements
2023.05.02 04:27:35 INFO  web[][o.s.s.a.p.ExpiredSessionsCleaner] Purge of expired SAML message ids has removed 0 elements
2023.05.02 04:27:35 INFO  web[][o.s.s.n.NotificationDaemon] Notification service started (delay 60 sec.)
2023.05.02 04:27:35 INFO  web[][o.s.s.t.TelemetryDaemon] Sharing of SonarQube statistics is enabled.
2023.05.02 04:27:36 INFO  web[][o.s.s.s.GeneratePluginIndex] Generate scanner plugin index
2023.05.02 04:27:36 INFO  web[][o.s.s.s.RegisterMetrics] Register metrics
2023.05.02 04:27:36 INFO  web[][o.s.s.r.RegisterRules] Register rules
2023.05.02 04:27:51 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@6995bf68-org.sonar.server.rule.RegisterRules': Initialization of bean failed; nested exception is org.apache.ibatis.exceptions.PersistenceException: \n### Error committing transaction.  Cause: org.apache.ibatis.executor.BatchExecutorException: org.sonar.db.rule.RuleMapper.insertRule (batch index #1) failed. Cause: java.sql.BatchUpdateException: Cannot insert the value NULL into column 'plugin_rule_key', table 'XXXXXX.dbo.rules'; column does not allow nulls. INSERT fails.\n### Cause: org.apache.ibatis.executor.BatchExecutorException: org.sonar.db.rule.RuleMapper.insertRule (batch index #1) failed. Cause: java.sql.BatchUpdateException: Cannot insert the value NULL into column 'plugin_rule_key', table 'XXXXXX.dbo.rules'; column does not allow nulls. INSERT fails.
2023.05.02 04:27:51 ERROR web[][o.s.s.p.Platform] Background initialization failed. Stopping SonarQube
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jdk.internal.loader.ClassLoaders$AppClassLoader@6995bf68-org.sonar.server.rule.RegisterRules': Initialization of bean failed; nested exception is org.apache.ibatis.exceptions.PersistenceException: 
### Error committing transaction.  Cause: org.apache.ibatis.executor.BatchExecutorException: org.sonar.db.rule.RuleMapper.insertRule (batch index #1) failed. Cause: java.sql.BatchUpdateException: Cannot insert the value NULL into column 'plugin_rule_key', table 'XXXXXXXXX.dbo.rules'; column does not allow nulls. INSERT fails.
### Cause: org.apache.ibatis.executor.BatchExecutorException: org.sonar.db.rule.RuleMapper.insertRule (batch index #1) failed. Cause: java.sql.BatchUpdateException: Cannot insert the value NULL into column 'plugin_rule_key', table 'XXXXXXX.dbo.rules'; column does not allow nulls. INSERT fails.
	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:918)
	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.PlatformLevelStartup.access$001(PlatformLevelStartup.java:55)
	at org.sonar.server.platform.platformlevel.PlatformLevelStartup$1.doPrivileged(PlatformLevelStartup.java:127)
	at org.sonar.server.user.DoPrivileged.execute(DoPrivileged.java:45)
	at org.sonar.server.platform.platformlevel.PlatformLevelStartup.start(PlatformLevelStartup.java:124)
	at org.sonar.server.platform.PlatformImpl.executeStartupTasks(PlatformImpl.java:183)
	at org.sonar.server.platform.PlatformImpl$AutoStarterRunnable.runIfNotAborted(PlatformImpl.java:344)
	at org.sonar.server.platform.PlatformImpl$1.doRun(PlatformImpl.java:107)
	at org.sonar.server.platform.PlatformImpl$AutoStarterRunnable.run(PlatformImpl.java:328)
	at java.base/java.lang.Thread.run(Unknown Source)
Caused by: org.apache.ibatis.exceptions.PersistenceException: 
### Error committing transaction.  Cause: org.apache.ibatis.executor.BatchExecutorException: org.sonar.db.rule.RuleMapper.insertRule (batch index #1) failed. Cause: java.sql.BatchUpdateException: Cannot insert the value NULL into column 'plugin_rule_key', table 'XXXXXXX.dbo.rules'; column does not allow nulls. INSERT fails.
### Cause: org.apache.ibatis.executor.BatchExecutorException: org.sonar.db.rule.RuleMapper.insertRule (batch index #1) failed. Cause: java.sql.BatchUpdateException: Cannot insert the value NULL into column 'plugin_rule_key', table 'XXXXXXX.dbo.rules'; column does not allow nulls. INSERT fails.
	at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.commit(DefaultSqlSession.java:223)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.commit(DefaultSqlSession.java:214)
	at org.sonar.db.DbSessionImpl.commit(DbSessionImpl.java:42)
	at org.sonar.db.BatchSession.commit(BatchSession.java:168)
	at org.sonar.server.rule.RegisterRules.start(RegisterRules.java:134)
	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)
	... 19 common frames omitted
Caused by: org.apache.ibatis.executor.BatchExecutorException: org.sonar.db.rule.RuleMapper.insertRule (batch index #1) failed. Cause: java.sql.BatchUpdateException: Cannot insert the value NULL into column 'plugin_rule_key', table 'XXXXXXX.dbo.rules'; column does not allow nulls. INSERT fails.
	at org.apache.ibatis.executor.BatchExecutor.doFlushStatements(BatchExecutor.java:149)
	at org.apache.ibatis.executor.BaseExecutor.flushStatements(BaseExecutor.java:129)
	at org.apache.ibatis.executor.BaseExecutor.flushStatements(BaseExecutor.java:122)
	at org.apache.ibatis.executor.BaseExecutor.commit(BaseExecutor.java:242)
	at org.apache.ibatis.executor.CachingExecutor.commit(CachingExecutor.java:119)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.commit(DefaultSqlSession.java:220)
	... 27 common frames omitted
Caused by: java.sql.BatchUpdateException: Cannot insert the value NULL into column 'plugin_rule_key', table 'XXXXXXX.dbo.rules'; column does not allow nulls. INSERT fails.
	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeBatch(SQLServerPreparedStatement.java:2138)
	at com.zaxxer.hikari.pool.ProxyStatement.executeBatch(ProxyStatement.java:127)
	at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeBatch(HikariProxyPreparedStatement.java)
	at org.apache.ibatis.executor.BatchExecutor.doFlushStatements(BatchExecutor.java:123)
	... 32 common frames omitted
2023.05.02 04:27:51 INFO  web[][o.s.p.ProcessEntryPoint] Hard stopping process
2023.05.02 04:27:51 INFO  web[][o.s.s.e.CoreExtensionStopper] Stopping Governance
2023.05.02 04:27:51 INFO  web[][o.s.s.e.CoreExtensionStopper] Stopping Governance (done) | time=0ms
2023.05.02 04:27:51 INFO  web[][o.s.s.n.NotificationDaemon] Notification service stopped
2023.05.02 04:27:51 INFO  web[][c.z.h.HikariDataSource] HikariPool-1 - Shutdown initiated...
2023.05.02 04:27:51 INFO  web[][c.z.h.HikariDataSource] HikariPool-1 - Shutdown completed.

Hey there.

Are you installing any third-party community supported plugins?

Below mentioned are the plugins I am installing.

sonar-auth-aad-plugin-1.2.0.jar
sonar-rci-plugin-1.0.2.jar
sonar-scm-tfvc-plugin-2.4.0.127.jar
sonar-shellcheck-plugin-2.5.0.jar
sonar-softvis3d-plugin-1.2.1.jar
sonar-typescript-plugin-2.1.0.4359.jar
sonar-yaml-plugin-1.7.0.jar

Thanks.

You might want to try uninstalling them 1 by 1 to see if a specific one is causing an issue. And:

You should not install this plugin (on either v9.6 or v9.9). It is not compatible and the features are now baked into the core of SonarQube.