Sonarqube 9.9 upgrade error

Make sure to tell us:

  • What version are you upgrading from?- 9.6 to 9.9
  • System information (Operating system, Java version, Database provider/version):-using ubuntu 22.04, java 17, postgrlsql 14.
  • What’s the issue you’re facing?
    please find below error details
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jdk.internal.loader.ClassLoaders$AppClassLoader@5ffd2b27-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.insertRuleDescriptionSection (batch index #6) failed. 5 prior sub executor(s) completed successfully, but will be rolled back. Cause: java.sql.BatchUpdateException: Batch entry 0 insert into rule_desc_sections (
      uuid,
      rule_uuid,
      kee,
      content,
      context_key,
      context_display_name
    )
    values (
      'AYM6bmjsYUbNt8vgCGE7',
      'AXoEd8IYzhHA0r9q15f_',
      'default',
      '<p>Shared naming conventions allow teams to collaborate effectively. This rule raises an issue when a local variable or function parameter name does
not match the provided regular expression.</p>
<h2>Exceptions</h2>
<p>Loop counters are ignored by this rule.</p>
<pre>
for i in range(limit):  # Compliant
    print(i)
</pre>',
      NULL,
      NULL
    ) was aborted: ERROR: duplicate key value violates unique constraint "pk_rule_desc_sections"
  Detail: Key (uuid)=(AYM6bmjsYUbNt8vgCGE7) already exists.  Call getNextException to see other errors in the batch.
### Cause: org.apache.ibatis.executor.BatchExecutorException: org.sonar.db.rule.RuleMapper.insertRuleDescriptionSection (batch index #6) failed. 5 prior sub executor(s) completed successfully, but will be rolled back. Cause: java.sql.BatchUpdateException: Batch entry 0 insert into rule_desc_sections (
      uuid,
      rule_uuid,
      kee,
      content,
      context_key,
      context_display_name
    )
    values (
      'AYM6bmjsYUbNt8vgCGE7',
      'AXoEd8IYzhHA0r9q15f_',
      'default',
      '<p>Shared naming conventions allow teams to collaborate effectively. This rule raises an issue when a local variable or function parameter name does
not match the provided regular expression.</p>
<h2>Exceptions</h2>
<p>Loop counters are ignored by this rule.</p>
<pre>
for i in range(limit):  # Compliant
    print(i)
</pre>',
      NULL,
      NULL
    ) was aborted: ERROR: duplicate key value violates unique constraint "pk_rule_desc_sections"
  Detail: Key (uuid)=(AYM6bmjsYUbNt8vgCGE7) already exists.  Call getNextException to see other errors in the batch.
	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(Thread.java:833)
Caused by: org.apache.ibatis.exceptions.PersistenceException: 
### Error committing transaction.  Cause: org.apache.ibatis.executor.BatchExecutorException: org.sonar.db.rule.RuleMapper.insertRuleDescriptionSection (batch index #6) failed. 5 prior sub executor(s) completed successfully, but will be rolled back. Cause: java.sql.BatchUpdateException: Batch entry 0 insert into rule_desc_sections (
      uuid,
      rule_uuid,
      kee,
      content,
      context_key,
      context_display_name
    )
    values (
      'AYM6bmjsYUbNt8vgCGE7',
      'AXoEd8IYzhHA0r9q15f_',
      'default',
      '<p>Shared naming conventions allow teams to collaborate effectively. This rule raises an issue when a local variable or function parameter name does
not match the provided regular expression.</p>
<h2>Exceptions</h2>
<p>Loop counters are ignored by this rule.</p>
<pre>
for i in range(limit):  # Compliant
    print(i)
</pre>',
      NULL,
      NULL
    ) was aborted: ERROR: duplicate key value violates unique constraint "pk_rule_desc_sections"
  Detail: Key (uuid)=(AYM6bmjsYUbNt8vgCGE7) already exists.  Call getNextException to see other errors in the batch.
### Cause: org.apache.ibatis.executor.BatchExecutorException: org.sonar.db.rule.RuleMapper.insertRuleDescriptionSection (batch index #6) failed. 5 prior sub executor(s) completed successfully, but will be rolled back. Cause: java.sql.BatchUpdateException: Batch entry 0 insert into rule_desc_sections (
      uuid,
      rule_uuid,
      kee,
      content,
      context_key,
      context_display_name
    )
    values (
      'AYM6bmjsYUbNt8vgCGE7',
      'AXoEd8IYzhHA0r9q15f_',
      'default',
      '<p>Shared naming conventions allow teams to collaborate effectively. This rule raises an issue when a local variable or function parameter name does
not match the provided regular expression.</p>
<h2>Exceptions</h2>
<p>Loop counters are ignored by this rule.</p>
<pre>
for i in range(limit):  # Compliant
    print(i)
</pre>',
      NULL,
      NULL
    ) was aborted: ERROR: duplicate key value violates unique constraint "pk_rule_desc_sections"
  Detail: Key (uuid)=(AYM6bmjsYUbNt8vgCGE7) already exists.  Call getNextException to see other errors in the batch.
	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.insertRuleDescriptionSection (batch index #6) failed. 5 prior sub executor(s) completed successfully, but will be rolled back. Cause: java.sql.BatchUpdateException: Batch entry 0 insert into rule_desc_sections (
      uuid,
      rule_uuid,
      kee,
      content,
      context_key,
      context_display_name
    )
    values (
      'AYM6bmjsYUbNt8vgCGE7',
      'AXoEd8IYzhHA0r9q15f_',
      'default',
      '<p>Shared naming conventions allow teams to collaborate effectively. This rule raises an issue when a local variable or function parameter name does
not match the provided regular expression.</p>
<h2>Exceptions</h2>
<p>Loop counters are ignored by this rule.</p>
<pre>
for i in range(limit):  # Compliant
    print(i)

Hi,

Are you using any 3rd-party plugins?

 
Ann

No. I am not usu any 3rd party plugin

Hello Ann,

In sonar log file I am able to last line as “INFO app[o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running”

please help me to resolved by issue.
After sonarqube upgrade from 9.6 .to 9.9 I run /setup command, after that database upgrade done and receving below error in web
" SonarQube is offline

The connection to SonarQube is lost. Please contact your system administrator."

Hi,

Can you post your web.log, redacted as necessary, please?

 
Thx,
Ann

web.log (537.2 KB)
Hello Ann,

Please find attached log details.
if you have any document details of upgrade, please share.

Hi,

Actually, you do have a 3rd-party plugin. Could you remove the Swift (Backelite) plugin and try again?

 
Ann

Hello Ann,

Removed asked plugin till issue not resolved.

Thank and Regards,

Prashant Rajput

Hi,

Can you send the new log?

 
Ann

Hello Ann,

please find attached zip file of log, please unzip and check. Thank you.
web_log_zip.zip (759.8 KB)

1 Like

Hi,

I see in the last log you sent us many attempt (918!) to start SonarQube and obtained different stacktraces.

It seems that sometimes the following error prevents the startupt:

2023.04.04 09:16:26 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@5ffd2b27-org.sonar.server.qualityprofile.RegisterQualityProfiles': Initialization of bean failed; nested exception is BadRequestException{errors=[Rule with UUID AYCtsnhrXorJG4xCju3- not found]}

And sometimes:

### Error committing transaction.  Cause: org.apache.ibatis.executor.BatchExecutorException: org.sonar.db.rule.RuleMapper.insertRuleDescriptionSection (batch index #6) failed. 5 prior sub executor(s) completed successfully, but will be rolled back. Cause: java.sql.BatchUpdateException: Batch entry 0 insert into rule_desc_sections (
      uuid,
      rule_uuid,
      kee,
      content,
      context_key,
      context_display_name
    )
    values (
      'AYM6bmjsYUbNt8vgCGE7',
      'AXoEd8IYzhHA0r9q15f_',
      'default',
      '<p>Shared naming conventions allow teams to collaborate effectively. This rule raises an issue when a local variable or function parameter name does
not match the provided regular expression.</p>
<h2>Exceptions</h2>
<p>Loop counters are ignored by this rule.</p>
<pre>
[...]

It seems that something is corrupted in the DB. Could you please activate the debug mode for the logging and send us the new log, to see if we see interesting information for the diagnosis?