Upgrade from 9.6.1 to 9.9 is failing to start on db upgrade

Make sure to tell us:

  • What version are you upgrading from? - 9.6.1
  • System information (Operating system, Java version, Database provider/version) Ubuntu Focal 20.04, openjdk 17,
  • What’s the issue you’re facing?
    When I run setup for DB upgrade using UI,
023.09.15 13:40:13 WARN  web[][o.s.s.a.LogOAuthWarning] For security reasons, OAuth authentication should use HTTPS. You should set the property 'Administration > Configuration > Server base URL' to a HTTPS URL.
2023.09.15 13:40:13 INFO  web[][o.s.s.p.UpdateCenterClient] Update center: https://update.sonarsource.org/update-center.properties
2023.09.15 13:40:14 INFO  web[][o.s.a.l.LdapSettingsManager] User mapping: LdapUserMapping{baseDn=dc=eikplatform,dc=io, request=(&(objectClass=user)(sAMAccountName={0})), realNameAttribute=cn, emailAttribute=mail}
2023.09.15 13:40:14 INFO  web[][o.s.a.l.LdapSettingsManager] Group mapping: LdapGroupMapping{baseDn=CN=acl.sonarqube.admins,OU=Permissions,OU=Groups,OU=EIK,DC=eikplatform,DC=io, idAttribute=cn, requiredUserAttributes=[dn], request=(&(objectClass=groupOfUniqueNames)(uniqueMember={0}))}
2023.09.15 13:40:14 INFO  web[][o.s.a.l.LdapContextFactory] Test LDAP connection on ldaps://cgd-co-ad1.eikplatform.io: OK
2023.09.15 13:40:14 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action saml/validation_init
2023.09.15 13:40:14 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/system/liveness
2023.09.15 13:40:14 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/plugins/download
2023.09.15 13:40:14 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/analysis_cache/get
2023.09.15 13:40:14 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/alm_integrations/check_pat
2023.09.15 13:40:14 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/push/sonarlint_events
2023.09.15 13:40:14 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/support/info
2023.09.15 13:40:14 INFO  web[][o.s.s.n.NotificationDaemon] Notification service started (delay 60 sec.)
2023.09.15 13:40:14 INFO  web[][o.s.s.t.TelemetryDaemon] Sharing of SonarQube statistics is enabled.
2023.09.15 13:40:14 INFO  web[][o.s.s.s.GeneratePluginIndex] Generate scanner plugin index
2023.09.15 13:40:14 INFO  web[][o.s.s.s.RegisterMetrics] Register metrics
2023.09.15 13:40:15 INFO  web[][o.s.s.r.RegisterRules] Register rules

2023.09.15 13:40:20 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.rule.RegisterRules': Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: expected one element but was: <RuleDescriptionSectionDto[uuid='AYOyN0D14kyKjPFp2nTF', key='default', content='<p>Marking a variable that is unchanged after initialization <code>const</code> is an indication to future maintainers that "no this isn’t updated,\nand it’s not supposed to be". <code>const</code> should be used in these situations in the interests of code clarity.</p>\n<h2>Noncompliant Code Example</h2>\n<pre>\npublic bool Seek(int[] input)\n{\n  int target = 32;  // Noncompliant\n  foreach (int i in input)\n  {\n    if (i == target)\n    {\n      return true;\n    }\n  }\n  return false;\n}\n</pre>\n<h2>Compliant Solution</h2>\n<pre>\npublic bool Seek(int[] input)\n{\n  const int target = 32;\n  foreach (int i in input)\n  {\n    if (i == target)\n    {\n      return true;\n    }\n  }\n  return false;\n}\n</pre>', context='null'], RuleDescriptionSectionDto[uuid='AYqYpE5LZNDXn4uEgwig', key='default', content='<p>Marking a variable that is unchanged after initialization <code>const</code> is an indication to future maintainers that "no this isn’t updated,\nand it’s not supposed to be". <code>const</code> should be used in these situations in the interests of code clarity.</p>\n<h2>Noncompliant Code Example</h2>\n<pre>\npublic bool Seek(int[] input)\n{\n  var target = 32;  // Noncompliant\n  foreach (int i in input)\n  {\n    if (i == target)\n    {\n      return true;\n    }\n  }\n  return false;\n}\n</pre>\n<p>or</p>\n<pre>\npublic class Sample\n{\n  public void Method()\n  {\n    var context = $"{nameof(Sample)}.{nameof(Method)}";  // Noncompliant (C# 10 and above only)\n  }\n}\n</pre>\n<h2>Compliant Solution</h2>\n<pre>\npublic bool Seek(int[] input)\n{\n  const int target = 32;\n  foreach (int i in input)\n  {\n    if (i == target)\n    {\n      return true;\n    }\n  }\n  return false;\n}\n</pre>\n<p>or</p>\n<pre>\npublic class Sample\n{\n  public void Method()\n  {\n    const string context = $"{nameof(Sample)}.{nameof(Method)}";\n  }\n}\n</pre>', context='null']>
2023.09.15 13:40:20 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.rule.RegisterRules': Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: expected one element but was: <RuleDescriptionSectionDto[uuid='AYOyN0D14kyKjPFp2nTF', key='default', content='<p>Marking a variable that is unchanged after initialization <code>const</code> is an indication to future maintainers that "no this isn’t updated,
and it’s not supposed to be". <code>const</code> should be used in these situations in the interests of code clarity.</p>
<h2>Noncompliant Code Example</h2>
<pre>
public bool Seek(int[] input)
{
  int target = 32;  // Noncompliant
  foreach (int i in input)
  {
    if (i == target)
    {
      return true;
    }
  }
  return false;
}
</pre>
<h2>Compliant Solution</h2>
<pre>
public bool Seek(int[] input)
{
  const int target = 32;
  foreach (int i in input)
  {
    if (i == target)
    {
      return true;
    }
  }
  return false;
}
</pre>', context='null'], RuleDescriptionSectionDto[uuid='AYqYpE5LZNDXn4uEgwig', key='default', content='<p>Marking a variable that is unchanged after initialization <code>const</code> is an indication to future maintainers that "no this isn’t updated,
and it’s not supposed to be". <code>const</code> should be used in these situations in the interests of code clarity.</p>
<h2>Noncompliant Code Example</h2>
<pre>
public bool Seek(int[] input)
{
  var target = 32;  // Noncompliant
  foreach (int i in input)
  {
    if (i == target)
    {
      return true;
    }
  }
  return false;
}
</pre>
<p>or</p>
<pre>
public class Sample
{
  public void Method()
  {
    var context = $"{nameof(Sample)}.{nameof(Method)}";  // Noncompliant (C# 10 and above only)
  }
}
</pre>
<h2>Compliant Solution</h2>
<pre>
public bool Seek(int[] input)
{
  const int target = 32;
  foreach (int i in input)
  {
    if (i == target)
    {
      return true;
    }
  }
  return false;
}
</pre>
<p>or</p>
<pre>
public class Sample
{
  public void Method()
  {
    const string context = $"{nameof(Sample)}.{nameof(Method)}";
  }
}
</pre>', context='null']>
        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.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: java.lang.IllegalArgumentException: expected one element but was: <RuleDescriptionSectionDto[uuid='AYOyN0D14kyKjPFp2nTF', key='default', content='<p>Marking a variable that is unchanged after initialization <code>const</code> is an indication to future maintainers that "no this isn’t updated,
and it’s not supposed to be". <code>const</code> should be used in these situations in the interests of code clarity.</p>
<h2>Noncompliant Code Example</h2>
<pre>
public bool Seek(int[] input)
{
  int target = 32;  // Noncompliant
  foreach (int i in input)
  {
    if (i == target)
    {
      return true;
    }
  }
  return false;
}
</pre>
<h2>Compliant Solution</h2>
<pre>
public bool Seek(int[] input)
{
  const int target = 32;
  foreach (int i in input)
  {
    if (i == target)
    {
      return true;
    }
  }
  return false;
}
</pre>', context='null'], RuleDescriptionSectionDto[uuid='AYqYpE5LZNDXn4uEgwig', key='default', content='<p>Marking a variable that is unchanged after initialization <code>const</code> is an indication to future maintainers that "no this isn’t updated,
and it’s not supposed to be". <code>const</code> should be used in these situations in the interests of code clarity.</p>
<h2>Noncompliant Code Example</h2>
<pre>
public bool Seek(int[] input)
{
  var target = 32;  // Noncompliant
  foreach (int i in input)
  {
    if (i == target)
    {
      return true;
    }
  }
  return false;
}
</pre>
<p>or</p>
<pre>
public class Sample
{
  public void Method()
  {
    var context = $"{nameof(Sample)}.{nameof(Method)}";  // Noncompliant (C# 10 and above only)
  }
}
</pre>
<h2>Compliant Solution</h2>
<pre>
public bool Seek(int[] input)
{
  const int target = 32;
  foreach (int i in input)
  {
    if (i == target)
    {
      return true;
    }
  }
  return false;
}
</pre>
<p>or</p>
<pre>
public class Sample
{
  public void Method()
  {
    const string context = $"{nameof(Sample)}.{nameof(Method)}";
  }
}
</pre>', context='null']>
        at com.google.common.collect.MoreCollectors$ToOptionalState.multiples(MoreCollectors.java:114)
        at com.google.common.collect.MoreCollectors$ToOptionalState.getOptional(MoreCollectors.java:156)
        at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:686)
        at org.sonar.server.rule.RuleDescriptionFormatter.retrieveDescription(RuleDescriptionFormatter.java:48)
        at org.sonar.server.rule.RuleDescriptionFormatter.getDescriptionAsHtml(RuleDescriptionFormatter.java:41)
        at org.sonar.server.rule.CachingRuleFinder.toRule(CachingRuleFinder.java:164)
        at org.sonar.server.rule.CachingRuleFinder.buildRulesByRuleDefinitionDto(CachingRuleFinder.java:80)
        at org.sonar.server.rule.CachingRuleFinder.<init>(CachingRuleFinder.java:70)
        at org.sonar.server.rule.WebServerRuleFinderImpl.startCaching(WebServerRuleFinderImpl.java:48)
        at org.sonar.server.rule.RegisterRules.start(RegisterRules.java:155)
        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
2023.09.15 13:40:21 INFO  web[][o.s.p.ProcessEntryPoint] Hard stopping process
2023.09.15 13:40:21 INFO  web[][o.s.s.n.NotificationDaemon] Notification service stopped
2023.09.15 13:40:21 INFO  web[][c.z.h.HikariDataSource] HikariPool-1 - Shutdown initiated...
2023.09.15 13:40:21 INFO  web[][c.z.h.HikariDataSource] HikariPool-1 - Shutdown completed.

Hi,

Are you using any 3rd-party plugins? If so, can you uninstall them and try startup again?

 
Ann

Nope, The plugins I used in 9.6 version, I did not put it back in 9.9… so the extensions folder under plugins is empty.

Hi,

Could you please post your full web.log? I’ve identified the rule in question: csharpsquid:S3353, and I’m going to call for more expert help.

 
Ann

Hi Ann,

We were able to fix it with below steps. First of all the old version 9.6 of sonarqube was using postgres version 10 which is incompatible with 9.9 LTS sonarqube version.So we did the following steps and were able to upgrade to 9.9 successfully:

  1. Upgrade postgres DB manually from 10 to 15 using pg_upgrade binary
  2. Alter the user of database to use new password.
  3. Reindex the database
  4. Update the sonar.properties of the new 9.9 to use ldap and sonar profile as old one
  5. Install openjdk 17
  6. Start sonar service and from UI run /setup from UI

Then the Sonar service was able to run successfully.
Thanks a lot for responding and take time to investigate the issue.

Regards,
Monali

1 Like