The last post about SonarQube described an update of version. Unfortunately, I was a bit late between the time I did the upgrade and when I wrote the post, so that in the meantimes, a new version of SonarQube has been available.
This is a version 4.0 (so, a major one), that I did install this weekend. And as I did some errors, this is an opportunity to update this post SonarQube upgrade and to document these error messages and how I solved them.
I will not detail all the steps of upgrade as in the previous article, but simply specify the errors encountered.
SonarQube 4.0
Preliminary steps
These steps are:
- First, verify that SonarQube is not enabled. If this is the case, stop the Sonar service.
- Do a backup of your SonarQube current environment. We already have seen how to do a backup of your Oracle database.
- Uninstall the existing Sonar service. We can delete it with the ‘UninstallNTService.bat’ that you can find in the folder corresponding to our operating system, in the directory ‘..\bin’ of the current release of SonarQube.
Note: I did try this uninstall with any other ‘UninstallNTService.bat’ file, from another version or from a 32 or 64 bits release and it works.
I will then download the version 4.0 ofSonarQube, from this page on SonarSource.
SonarQube 4.0 installation
Then I proceed as usual:
- Unzip of the SonarQube 4.0 release in its own directory.
- Copy of the .jar files of the installed plugins (from the previous version) into the corresponding folder in the new version: ‘..\sonar-4.0\extensions\plugins’.
- Copy of the Oracle database driver ‘ojdbc6.jar’ into the new folder ‘..\sonar-4,0\extensions\jdbc-driver\oracle’ (as I use an Oracle database).
- Copy of the files ‘sonar.properties’ (with the environment parameters) and ‘wrapper.conf’ into the new directory ‘..\sonar-4.0\conf’. Beware: if you are following this post step by step, don’t do this one as it is erroneous (see hereunder)..
- Install the new Windows service Sonar in its 4.0 version, with the file ‘InstallNTService.bat’ that you will find under the directory ‘sonar-4,0\bin\’ and in the sub-directory corresponding to your OS.
Once we have finished with these operations, we can start the Sonar Service … except that it returns the following error message:
And the file ‘sonar.log’ displays this error: WrapperSimpleApp: Encountered an error running main: java.lang.IllegalStateException: Do not copy-paste the configuration files (conf directory) from the old version. Update the content of the new files instead.
As always, I did consult the Releases Notes page, but I did not take care to the upgrade page that has been modified: it now explains that you must not copy anymore the configuration files, but update them instead. So the previous step 4 was not correct.
In fact, I did not modify the file ‘wrapper.conf’ but only the ‘sonar.properties’ file with the indication of the Oracle database. Once our configuration is done, we can lauch the upgrade procedure from the ‘setup’ page ‘http://localhost:9000/setup’.
SonarQube must do an upgrade of the database:
I click the ‘Upgrade’ button to start this update. But it ends with the following error message which I believe that it is caused by of an old version of the ‘Sqale’ plugin.
Update of the Sqale plugin
So, I will look to the page related to this plugin on the SonarSource website :
We can find a new version of this plugin, that works specifically with the version 4.0 of SonarQube.
So I will:
- Download this plugin into the directory ‘..\sonar-4.0\extensions\plugins’.
- Stop / Start the new Windows service Sonar.
- Launch again the setup of SonarQube : ‘http://localhost:9000/setup’
Yes! The upgrade has been done correctly.
Update of other plugins
The previous example showed us that sometimes it may be necessary to install a new version of a plugin before installing a new version of SonarQube. This is why it is recommended to do these updates through the Update Center, as we saw inl the post SonarQube upgrade,
So I will follow the same procedure:
- Connect as a Sonar admin
- Go to the Update Center and activate the upgrade of the plugins that require an update:
SonarQube lists the plugins whose version will be updated.
Note that the upgrade from Java 1.4 to Java 1.5 results in an update of different plugins (findbugs, pmd, etc).
Once we have activated the upgrade of all the plugins that need to be upddated, we can Re-start the Windows service Sonar and get back to SonarQube.
If you connect again in the Update Center, you can see that your SonarQube installation is up-to-date with the release 4.0 and that all the plugins are now in their most recent version.
Et voilà ! We can now discover what is new in this 4.0 version and these new plugins. See you soon for a new post.
This post is also available in Leer este articulo en castellano and Lire cet article en français.