Sonarqube upgrade from 8.9 to 9.4 with DB postgres

Hi Team,

I have installed SonarQube developer 9.4 version pointing to 8.9 version’s Postgres DB and performed steps mentioned in below url of zip file activity.
Upgrade Guide | SonarQube Docs
After the execution of step 6 the server got stopped in between.
I am still getting error service is not starting, if required we will share the logs as well.

Could you please help us on this issue.

Regards,
Narendra Singamaneni.

Hey there.

What do the logs say?

You are probably most interested in the web.log file, but make sure to check each one.

Hi Colin,

we verified all logs it is not showing any error message
es.log and sonar.log , web.log
[19:34] Narendra Chowdary Singamaneni

==================
web.log

[pattern=UrlPattern{inclusions=[/api/system/migrate_db.*, ...], exclusions=[/api/components/update_key, ...]}]
2022.05.25 11:23:15 INFO web[][o.s.s.p.DetectPluginChange] Detect plugin changes
2022.05.25 11:23:15 INFO web[][o.s.s.a.EmbeddedTomcat] HTTP connector enabled on port 9000
2022.05.25 11:23:15 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@55054057-org.sonar.server.platform.serverid.ServerIdManager': Initialization of bean failed; nested exception is org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 2
2022.05.25 11:23:15 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@55054057-org.sonar.server.platform.serverid.ServerIdManager': Initialization of bean failed; nested exception is org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 2
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:953)
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.PlatformLevel3.start(PlatformLevel3.java:66)
at org.sonar.server.platform.PlatformImpl.start(PlatformImpl.java:196)
at org.sonar.server.platform.PlatformImpl.startLevel34Containers(PlatformImpl.java:176)
at org.sonar.server.platform.PlatformImpl$1.lambda$doRun$0(PlatformImpl.java:105)
at org.sonar.server.platform.PlatformImpl$AutoStarterRunnable.runIfNotAborted(PlatformImpl.java:344)
at org.sonar.server.platform.PlatformImpl$1.doRun(PlatformImpl.java:105)
at org.sonar.server.platform.PlatformImpl$AutoStarterRunnable.run(PlatformImpl.java:328)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 2
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:80)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:87)
at org.apache.ibatis.binding.MapperProxy$PlainMethodInvoker.invoke(MapperProxy.java:145)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:86)
at com.sun.proxy.$Proxy35.selectByKey(Unknown Source)
at org.sonar.db.property.PropertiesDao.selectGlobalProperty(PropertiesDao.java:144)
at org.sonar.server.platform.serverid.ServerIdManager.readCurrentServerId(ServerIdManager.java:121)
at org.sonar.server.platform.serverid.ServerIdManager.start(ServerIdManager.java:66)
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)
... 18 common frames omitted
2022.05.25 11:23:16 INFO web[][o.s.p.ProcessEntryPoint] Hard stopping process

==sonar.log==

2022.05.25 11:23:01 INFO app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2022.05.25 11:23:10 INFO app[][o.s.a.SchedulerImpl] Process[es] is up
2022.05.25 11:23:10 INFO app[][o.s.a.ProcessLauncherImpl] Launch process[WEB_SERVER] from [/opt/sonarqube-9.4]: /usr/lib/jvm/java-11-openjdk-11.0.14.1.1-1.el7_9.x86_64/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/opt/sonarqube-9.4/temp -XX:-OmitStackTraceInFastThrow --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED --add-exports=java.base/jdk.internal.ref=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.management/sun.management=ALL-UNNAMED --add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED -Dcom.redhat.fips=false -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Dhttp.nonProxyHosts=localhost|127.*|[::1] -cp ./lib/sonar-application-9.4.0.54424.jar:/opt/sonarqube-9.4/lib/jdbc/postgresql/postgresql-42.3.3.jar org.sonar.server.app.WebServer /opt/sonarqube-9.4/temp/sq-process15953019246796076480properties
2022.05.25 11:23:16 INFO app[][o.s.a.SchedulerImpl] Process[Web Server] is stopped
2022.05.25 11:23:16 WARN app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [ElasticSearch]: 143
2022.05.25 11:23:16 INFO app[][o.s.a.SchedulerImpl] Process[ElasticSearch] is stopped
2022.05.25 11:23:16 INFO app[][o.s.a.SchedulerImpl] SonarQube is stopped

It looks like something has gone wrong in your Database where SonarQube finds two server IDs on startup.

My first suggestion would be to restore from a backup of your SonarQube v8.9 LTS database (to restore service), and then rehearse your upgrade on a copy of this database.

Can you please explain the steps what needs to be follow

Hi ,

Could you please share me the steps which i need to follow for upgrade.

regards,
Narendra Singamaneni.

Hey there.

Have you followed this advice, and have your SonarQube v8.9 LTS instance up and running again?

Still 8.9 is up and running
please provide the steps for 8.9 to 9.4 sonarqube developer edition and using postgres DB
how to upgrade please suggest me.