10

I downloaded SonarQube 5.3, configured the sonar.properties file, downloaded the JDBC driver for MSSQL (I'm using SQL Server 2012 and SQL JDBC 4.2), created a user with all grants in my SQL Server 2012 instance with database sonar.

Then I execute startSonar.bat and this throws the following error:

2016.01.22 13:57:57 INFO  web[o.s.s.p.ServerImpl] SonarQube Server / 5.3 / 8db783e62b266eeb0d0b10dc050a7ca50e96c5d1
2016.01.22 13:57:57 INFO  web[o.sonar.db.Database] Create JDBC data source for jdbc:sqlserver://localhost;databaseName=sonar
2016.01.22 13:57:59 ERROR web[o.a.c.c.C.[.[.[/]] Exception sending context initialized event to listener instance of class org.sonar.server.platform.PlatformServletContextListener
org.sonar.api.utils.MessageException: Current version is too old. Please upgrade to Long Term Support version firstly.
2016.01.22 13:57:59 INFO  web[jruby.rack] jruby 1.7.9 (ruby-1.8.7p370) 2013-12-06 87b108a on Java HotSpot(TM) 64-Bit Server VM 1.8.0_66-b18 [Windows 7-amd64]
2016.01.22 13:57:59 INFO  web[jruby.rack] using a shared (threadsafe!) runtime
2016.01.22 13:58:05 ERROR web[jruby.rack] initialization failed
org.jruby.rack.RackInitializationException: java.lang.NullPointerException
    at org.jruby.rack.RackInitializationException.wrap(RackInitializationException.java:31) ~[jruby-rack-1.1.13.2.jar:na]
    at org.jruby.rack.RackApplicationFactoryDecorator.init(RackApplicationFactoryDecorator.java:98) ~[jruby-rack-1.1.13.2.jar:na]
    at org.jruby.rack.RackServletContextListener.contextInitialized(RackServletContextListener.java:50) ~[jruby-rack-1.1.13.2.jar:na]
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4720) [tomcat-embed-core-8.0.18.jar:8.0.18]
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5154) [tomcat-embed-core-8.0.18.jar:8.0.18]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [tomcat-embed-core-8.0.18.jar:8.0.18]
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409) [tomcat-embed-core-8.0.18.jar:8.0.18]
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399) [tomcat-embed-core-8.0.18.jar:8.0.18]
    at java.util.concurrent.FutureTask.run(Unknown Source) [na:1.8.0_66]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.8.0_66]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.8.0_66]
    at java.lang.Thread.run(Unknown Source) [na:1.8.0_66]
--- and then creates a cascade of errors ---

This is what's in the sonar.properties file:

# DATABASE
sonar.jdbc.username=sonar
sonar.jdbc.password=sonar

# Use the following connection string if you want to use SQL Auth while connecting to MS Sql Server.
# Set the sonar.jdbc.username and sonar.jdbc.password appropriately.
 sonar.jdbc.url=jdbc:sqlserver://localhost;databaseName=sonar

 # TCP port for incoming HTTP connections. Disabled when value is -1.
sonar.web.port=4950

All I see is "Current version is too old. Please upgrade to Long Term Support version firstly." but... upgrade what?

TT.
  • 15,774
  • 6
  • 47
  • 88
S. Moreno
  • 526
  • 2
  • 7
  • 29
  • I'm using sqljdbc_4.2 – S. Moreno Jan 22 '16 at 13:25
  • Possible duplicate of [SonarQube :: Current version is too old. Please upgrade to Long Term Support version firstly](https://stackoverflow.com/questions/38744817/sonarqube-current-version-is-too-old-please-upgrade-to-long-term-support-ver) – Naman Sep 12 '17 at 01:27

3 Answers3

16

This has nothing to do with your database brand or version, but with the version of the SonarQube platform you're upgrading from. Starting with version 4.5, new versions of the platform only accumulate database upgrade scripts starting from the previous Long Term Support version. So the SonarQube platform version 3.2 knows how to upgrade all the way from 1.5, but 5.3 only knows how to update the database starting from version 4.5.x.

So you must first upgrade to 4.5.x - I'd recommend 4.5.7 - and then upgrade to 5.3.

Update

5.6.7 is the current a previous LTS, so the current upgrade path from a hypothetical 3.2 install would be:

3.2 -> 4.5.7 -> 5.6.6

Update 1 Dec 17

6.7 is the current LTS, so the current upgrade path from a hypothetical 3.2 install would be:

3.2 -> 4.5.7. -> 5.6.7 -> 6.7

Intermediate versions can be skipped.

G. Ann - SonarSource Team
  • 22,346
  • 4
  • 40
  • 76
  • 4
    Maybe a better error message would avoid such confusion. – TT. Jan 23 '16 at 14:42
  • Finally i installed an anterior version and upgraded until 5.3. Works correctly, thank you!. – S. Moreno Jan 25 '16 at 12:23
  • 2
    Thanks. Resolved my problem. I'm using redhat. So I had to uninstall the current sonar (5.4) `yum remove sonar`, then installed sonar 4.5.6: `yum install sonar-4.5.6-1` and then went to /setup and upgraded the DB – Moshe.z Mar 30 '16 at 06:49
  • Moshe.z thank you for this most valuable comment. I clean installed sonar 5.4 on a clean rhel 7 system and was getting that non-sensical messageException. Thanks to your comment I uninstalled and downgraded to an older version of sonar and it "just works" with postgresql 10. If they don't want people using the newest version then don't make it available with `yum install sonar` – Justin Feb 23 '17 at 17:32
1

Just in case anyone has the same issue when installing a fresh SonarQube. Seems like you have to drop the tables every time when the installing process could not complete the creation of the database tables due to some other error.

I tried installing the latest version (7.0) facing this issue. I switched to the LTS version (6.7.3), but still the same error. Then I dropped all the tables that were created previously and then I had another issue with the binlog_format which had to be row-based. After correcting this issue, I had again the same error "version is too old".

Have a look in the logs/web.log file to find the error. After fixing the error drop the tables and let the process recreate the database.

benez
  • 1,856
  • 22
  • 28
0

anyone coming from bitnami postgres error-> ssh into the pod and get into your sonardb then execute this->

DO $$ DECLARE
    r RECORD;
BEGIN
    -- if the schema you operate on is not "current", you will want to
    -- replace current_schema() in query with 'schematodeletetablesfrom'
    -- and update the generate 'DROP...' accordingly.
    FOR r IN (SELECT tablename FROM pg_tables WHERE schemaname = current_schema()) LOOP
        EXECUTE 'DROP TABLE IF EXISTS ' || quote_ident(r.tablename) || ' CASCADE';
    END LOOP;
END $$;

VACUUM FULL
SAB
  • 23
  • 5