Postgres DB-Version error

Make sure to tell us:

  • What version are you upgrading from? Developer Edition version 8.9.10 (build 61524) to LTS 9.9 (build 65466)
  • System information (Operating system, Java version, Database provider/version)
    Linux
    Java: 17.0.6+10
    DB: sonarqube version > 11
  • What’s the issue you’re facing? DB-Version Error

Hallo community,

I started moving from LTS Developer Edition version 8.9.10 (build 61524) to LTS Developer Edition version 9.9. I made a dump of the Postgres-SQL totest with and started the LTS 9.9 (build 65466/), as a systemd service.

Systemd Configuration:

[Unit]
Description=SonarQube 9.x service
After=syslog.target network.target

[Service]
Environment="JAVA_HOME=/usr/java/jdk-17.0.6+10"
Environment="SONAR_JAVA_PATH=/usr/java/jdk-17.0.6+10/bin/java"
Type=forking

ExecStart=/opt/sonarqube-9.9.0.65466/bin/linux-x86-64/sonar.sh start
ExecStop=/opt/sonarqube-9.9.0.65466/bin/linux-x86-64/sonar.sh stop

User=sonar
Group=sonar
LimitNOFILE=65536
LimitNPROC=8192
#Restart=always

[Install]
WantedBy=multi-user.target 

I followed the Sonar update guides, have the right Version of Java, Postgres

https://docs.sonarqube.org/latest/setup-and-upgrade/lts-to-lts-release-upgrade-notes/

The server starts, but very short after shuts down with the following exception:

web.log

2023.03.15 10:57:19 INFO  web[][o.s.p.ProcessEntryPoint] Starting Web Server
2023.03.15 10:57:20 INFO  web[][o.s.s.p.LogServerVersion] SonarQube Server / 9.9.0.65466 / ce743843018827cb30c05735e7971523de34bb48
2023.03.15 10:57:20 INFO  web[][o.sonar.db.Database] Create JDBC data source for jdbc:postgresql://pgsqldevneu:5437/sonarqube_klon_20230120
2023.03.15 10:57:20 INFO  web[][c.z.h.HikariDataSource] HikariPool-1 - Starting...
2023.03.15 10:57:20 INFO  web[][c.z.h.p.HikariPool] HikariPool-1 - Added connection org.postgresql.jdbc.PgConnection@1869f114
2023.03.15 10:57:20 INFO  web[][c.z.h.HikariDataSource] HikariPool-1 - Start completed.
2023.03.15 10:57:22 INFO  web[][o.s.s.p.ServerFileSystemImpl] SonarQube home: /opt/sonarqube-9.9.0.65466
2023.03.15 10:57:22 INFO  web[][o.s.s.u.SystemPasscodeImpl] System authentication by passcode is disabled
2023.03.15 10:57:22 INFO  web[][o.s.c.e.CoreExtensionsLoader] Loaded core extensions: developer-edition, developer-scanner, developer-server, license, monitoring
*2023.03.15 10:57:22 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.DatabaseServerCompatibility': Initialization of bean failed; nested exception is Current version is too old. Please upgrade to Long Term Support version firstly.**
**2023.03.15 10:57:22 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.DatabaseServerCompatibility': Initialization of bean failed; nested exception is Current version is too old. Please upgrade to Long Term Support version firstly.**
*        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.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:4764)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5222)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1393)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1383)
        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:916)
        at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:835)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1393)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1383)
        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:916)
        at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:265)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.StandardService.startInternal(StandardService.java:430)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.startup.Tomcat.start(Tomcat.java:486)
        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: org.sonar.api.utils.MessageException: Current version is too old. Please upgrade to Long Term Support version firstly.*

/In the other logs there are no errors:/

es.log

2023.03.15 10:57:19 INFO  es[][o.e.n.Node] version[7.17.8], pid[335], build[default/tar/120eabe1c8a0cb2ae87cffc109a5b65d213e9df1/2022-12-02T17:33:09.727072865Z], OS[Linux/3.10.0-1062.9.1.el7.x86_64/amd64], JVM[Microsoft/OpenJDK 64-Bit Server VM/17.0.6/17.0.6+10-LTS]
2023.03.15 10:57:19 INFO  es[][o.e.n.Node] JVM home [/usr/java/jdk-17.0.6+10]
2023.03.15 10:57:19 INFO  es[][o.e.n.Node] JVM arguments [-XX:+UseG1GC, -Djava.io.tmpdir=/opt/sonarqube-9.9.0.65466/temp, -XX:ErrorFile=/opt/sonarqube-9.9.0.65466/logs/es_hs_err_pid%p.log, -Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -Djna.tmpdir=/opt/sonarqube-9.9.0.65466/temp, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dio.netty.allocator.numDirectArenas=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Dlog4j2.formatMsgNoLookups=true, -Djava.locale.providers=COMPAT, -Dcom.redhat.fips=false, -Des.enforce.bootstrap.checks=true, -Xmx512m, -Xms512m, -XX:MaxDirectMemorySize=256m, -XX:+HeapDumpOnOutOfMemoryError, -Des.path.home=/opt/sonarqube-9.9.0.65466/elasticsearch, -Des.path.conf=/opt/sonarqube-9.9.0.65466/temp/conf/es, -Des.distribution.flavor=default, -Des.distribution.type=tar, -Des.bundled_jdk=false]
2023.03.15 10:57:20 INFO  es[][o.e.p.PluginsService] loaded module [analysis-common]
2023.03.15 10:57:20 INFO  es[][o.e.p.PluginsService] loaded module [lang-painless]
2023.03.15 10:57:20 INFO  es[][o.e.p.PluginsService] loaded module [parent-join]
2023.03.15 10:57:20 INFO  es[][o.e.p.PluginsService] loaded module [reindex]
2023.03.15 10:57:20 INFO  es[][o.e.p.PluginsService] loaded module [transport-netty4]
2023.03.15 10:57:20 INFO  es[][o.e.p.PluginsService] no plugins loaded
2023.03.15 10:57:20 INFO  es[][o.e.e.NodeEnvironment] using [1] data paths, mounts [[/ (rootfs)]], net usable_space [181.4gb], net total_space [199.9gb], types [rootfs]
2023.03.15 10:57:20 INFO  es[][o.e.e.NodeEnvironment] heap size [512mb], compressed ordinary object pointers [true]
2023.03.15 10:57:20 INFO  es[][o.e.n.Node] node name [sonarqube], node ID [-hjziFqjQ42qYYAL2-9BVQ], cluster name [sonarqube], roles [data_frozen, master, remote_cluster_client, data, data_content, data_hot, data_warm, data_cold, ingest]

nohup.log

2023.03.15 10:57:18 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube-9.9.0.65466/temp
2023.03.15 10:57:18 INFO  app[][o.s.a.es.EsSettings] Elasticsearch listening on [HTTP: 127.0.0.1:9001, TCP: 127.0.0.1:40295]
2023.03.15 10:57:18 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[ELASTICSEARCH] from [/opt/sonarqube-9.9.0.65466/elasticsearch]: /opt/sonarqube-9.9.0.65466/elasticsearch/bin/elasticsearch
2023.03.15 10:57:18 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2023.03.15 10:57:19 INFO  app[][o.s.a.SchedulerImpl] Process[es] is up
2023.03.15 10:57:19 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[WEB_SERVER] from [/opt/sonarqube-9.9.0.65466]: /usr/java/jdk-17.0.6+10/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/opt/sonarqube-9.9.0.65466/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.9.0.65466.jar:/opt/sonarqube-9.9.0.65466/lib/jdbc/postgresql/postgresql-42.5.1.jar org.sonar.server.app.WebServer /opt/sonarqube-9.9.0.65466/temp/sq-process7716614905018976142properties
WARNING: A terminally deprecated method in java.lang.System has been called
WARNING: System::setSecurityManager has been called by org.sonar.process.PluginSecurityManager (file:/opt/sonarqube-9.9.0.65466/lib/sonar-application-9.9.0.65466.jar)
WARNING: Please consider reporting this to the maintainers of org.sonar.process.PluginSecurityManager
WARNING: System::setSecurityManager will be removed in a future release
2023.03.15 10:57:23 INFO  app[][o.s.a.SchedulerImpl] Process[Web Server] is stopped
2023.03.15 10:57:23 WARN  app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [ElasticSearch]: 143
2023.03.15 10:57:23 INFO  app[][o.s.a.SchedulerImpl] Process[ElasticSearch] is stopped
2023.03.15 10:57:23 INFO  app[][o.s.a.SchedulerImpl] SonarQube is stopped

sonar.log

2023.03.15 10:57:18 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube-9.9.0.65466/temp
2023.03.15 10:57:18 INFO  app[][o.s.a.es.EsSettings] Elasticsearch listening on [HTTP: 127.0.0.1:9001, TCP: 127.0.0.1:40295]
2023.03.15 10:57:18 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[ELASTICSEARCH] from [/opt/sonarqube-9.9.0.65466/elasticsearch]: /opt/sonarqube-9.9.0.65466/elasticsearch/bin/elasticsearch
2023.03.15 10:57:18 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2023.03.15 10:57:19 INFO  app[][o.s.a.SchedulerImpl] Process[es] is up
2023.03.15 10:57:19 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[WEB_SERVER] from [/opt/sonarqube-9.9.0.65466]: /usr/java/jdk-17.0.6+10/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/opt/sonarqube-9.9.0.65466/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.9.0.65466.jar:/opt/sonarqube-9.9.0.65466/lib/jdbc/postgresql/postgresql-42.5.1.jar org.sonar.server.app.WebServer /opt/sonarqube-9.9.0.65466/temp/sq-process7716614905018976142properties
2023.03.15 10:57:23 INFO  app[][o.s.a.SchedulerImpl] Process[Web Server] is stopped
2023.03.15 10:57:23 WARN  app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [ElasticSearch]: 143
2023.03.15 10:57:23 INFO  app[][o.s.a.SchedulerImpl] Process[ElasticSearch] is stopped
2023.03.15 10:57:23 INFO  app[][o.s.a.SchedulerImpl] SonarQube is stopped

Maybe you can help me out. I saw there are other Problems in the community board when moving from 8.9 to 9.9

Kind regards

Rami Salsaa

Hi Rami,

Welcome to the community!

It looks like you didn’t actually start from SonarQube 8.9.10. You should try upgrading to it (do the full install & upgrade) and only then to 9.9.

Welcome to the community!

Hi Ann,

thanks for your reply. But I am running 8.9.10, I upgraded from 8.9.8 to 8.9.10 then to 9.9
Current Version Screenshot:

Or did I miss something?

Regards,

Rami

Hi Rami,

You should definitely be able to upgrade from any point version of 8.9 directly to 9.9. Are you sure you don’t have an old DB floating around somewhere?

 
Ann

Thanks Ann.

actually not … I am making a new clone for the current-db (used in 8.9.x) to use in my update to 9.9.x

Greetings

Rami

Hi Rami,

Have you ever run a version lower than 8.9.*? Because the only way this error can happen is if the database is from a version older than 8.9.

8.9 itself wouldn’t run on a DB that was causing this error.

 
Ann

Hi Ann,

actually I was running an older version than 8.9.10 that is 8.1.0 before with same DB I am using now.
8.1.0 → 8.9.0 -->8.9.10
I launched the following sql-query on the DB-Table.
SELECT * FROM public.internal_properties
it delivers:
installation.date 1580118652320 1580118652320 (Mon 27 January 2020)
installation.version 8.1.0.31237 1580118652320

So, how to explain that? Are there any queries that can help locate the problem?
i do not want to lose my projects-analysis history.

Kindest regards,

Rami

Just a remark.
with fresh DB the Sonar 9.9 starts. So it has to be the DB-compatibility.

Hi,

When you went from 8.1 to 8.9.10, did you do the database migration step? Specifically, after you started up 8.9.10, did you navigate to http://yourSonarQubeServerURL/setup and push the button?

I think that may be the missing piece.

 
Ann

Hallo,

thank you for the follow up. :slight_smile:

from 8.1 to 8.9 0 did the setup DB-Structure-update step.

from 8.9.0 to 8.9.10 I did. I did not need to. I tried to do it now I get " Database is up-to-date"

for 9.9 I have used a clone of the db used with 8.9.10.

Any suggestions?

Regards and nice weekend!

Rami

Hi Rami,

I suggest shutting down your 9.9 instance and spinning the 8.9.10 instance back up, pointed to exactly the same DB to see what happens.

 
Ann

Hi Ann,

oddly enough version 8.9.10 made me update the db (clone from it’s productive db). After the clone update I could start the 9.9.x version successfully with the db-clone.

So I went ahead and (backuped the productive db) used it to start my 9.9 version. Version 9.9 executed maintenance and db-update. And now I am running LTS 9.9 successfully.

The one issue I have now is the dashboard is not showing my already defined projects (from gitlab).
And I am being pushed towards “set up a DevOps platform configuration.” . I can see the projects are there in the Administration area . I really do want to have my dashboard view form v 8.9.10 firstly then I will evtl. move to the suggested Dev-Ops-Configuration. Any tips?

But this ticket can be marked as solved.

Thanks for your kind support :slight_smile:

Regards,

Rami

Hi,

I’m glad you got through the upgrade. It sounds like your Elasticsearch indices are bad. Either that, or they were still re-populating when you looked. If you still don’t see any projects in the Projects page, then:

  • stop the server
  • delete $SONARQUBE-HOME/data/es7
  • restart

This will force a rebuild of the indices.

 
HTH,
Ann

Hi Ann, am also facing the same issue we have upgraded the sonarqube to the LTS 9.9 version in Kubernetes with help of Helm it was deployed successfully. The issue I was also facing is the dashboard is not showing my already-defined projects. And I am being pushed towards set up a DevOps platform configuration. I can see the projects are there in the Administration area. I came across your solution we have deployed in Kubernetes we can’t able to start or stop the container is there any way to remove the es7 folder.
Thanks for your kind support
Regards,
Jaya

Hi @Jaya_Lakshmi,

Welcome to the community!

Please create a new thread with all your details.

 
Ann