Confluence will not start up because the build number in the Home Directory doesn't match the build number in the Database, after upgrade
Platform Notice: Server and Data Center Only - This article only applies to Atlassian products on the server and data center platforms.
When attempting to upgrade to version 5.1.2 and higher of Confluence, the upgrade fails and the following error appearing in the logs:
2013-06-04 07:53:32,448 ERROR [main] [atlassian.confluence.setup.BootstrapApplicationStartupListener] checkConfigurationOnStartup Confluence will not start up because the build number in the Home Directory [<build number>] doesn't match the build number in the Database [<build number>].
The versions represented by the build numbers can be found on this page: Confluence Build Information.
This can be caused by one of the following situations:
- If you have just performed a site restore and you are running 5.1.4 or before, you may be encountering this bug: - CONF-29758Getting issue details... STATUS If your situation matches what is discussed in the description, please follow the workaround provided in that bug report.
- At some point in the past an upgrade failed.
- The Database has been restored to an earlier version, but the Home Directory hasn't, or vice versa.
In all cases, it means that not all upgrade tasks have run on both the Database and the Home Directory. The information about the version of Confluence is stored in the Database in the
confversion table and in the Home Directory in <confluence_home_directory>/confluence.cfg.xml.
confversion table, which stores information about the versions of Confluence your instance has been upgraded to, is actually a record of the upgrade tasks that have completed successfully. When an upgrade task completes, Confluence puts an entry in the
confversion table with the build number of that upgrade task. That is why the build numbers in the confversion table sometimes don't match the actual build numbers of releases; each upgrade task has a build number, and then each release has a build number that is higher than all the upgrade tasks that are required to upgrade to that version.
The Database by running:
select * from CONFVERSION;
The Home Directory by looking in the <confluence_home_directory>/confluence.cfg.xml file:
<confluence-configuration> ... <buildNumber>4215</buildNumber> ... </confluence-configuration>
Ideally, both the Database and Home Directory should be restored to a point before the failed upgrade attempt if possible. Once this has been done, ensure that the build number shown in the Database and the Home Directory are the same.
If restoring to a point is not possible, manually set the build numbers back to the lower value of the two. For example, If the Home Directory shows 4215, and the Database shows 3289, the Home Directory should be set to 3289, and then perform the upgrade should be attempted again. This will trigger all upgrade tasks that are in between the Confluence version that the database is using and the version of the installation files that are being upgraded to, as well as upgrading the Database and the Home Directory. To change the value in the Database, delete any entries that have a build number higher than the version in your home directory:
Under no circumstances should one remove all rows/version information from the conf version table
delete from confversion where buildnumber > YOUR_HOME_DIRECTORY_BUILD_NUMBER
To alter the Home Directory's build number, simply edit the <confluence_home_directory>/confluence.cfg.xml file.
If you are running an Oracle database and note that the
confluence.cfg.xml file contains the upgraded database build number, but the Table CONFVERSION shows the row similar to the example below
|4560123456||6441||2017-07-04 06:01:42.54||Locked for version upgrade to 7201|
As this involved modification to the database, you are strongly advised to create a backup of your database prior to modification
You can correct this issue manually by running queries to correct the problem:
UPDATE CONFVERSION SET VERSIONTAG = NULL WHERE CONFVERSIONID = 4560123456; UPDATE CONFVERSION SET BUILDNUMBER = 7201 WHERE CONFVERSIONID = 4560123456;
PLEASE REMEMBER TO COMMIT THE CHANGES (Oracle requires the changes to be committed before they are accepted)
This will result in the table being modified as below in this example:
Restart the Confluence application, login and verify that the system is functional.
As a precaution, shutdown Confluence, then restart the instance to verify that the fix is working post-restart. This ensures that your change was committed to the Oracle database.
Once this change has been made, the system should start without issue.