Confluence upgrade fails with "java.lang.NoClassDefFoundError: org/springframework/core/JdkVersion"
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Confluence upgrade fails right after generating the pre-upgrade recovery file.
Environment
This problem was identified in Confluence server and datacenter version 7.3.5. It could also affect other versions of Confluence.
Diagnosis
The following error appears in the atlassian-confluence.log
file:
2021-01-13 10:40:24,228 ERROR [Catalina-utility-1] [atlassian.confluence.plugin.PluginFrameworkContextListener] launchUpgrades Upgrade failed, application will not start: Upgrade task com.atlassian.confluence.upgrade.upgradetask.Hibernate5ConstraintNamesPreSchemaUpgradeTask@7b93a3fc failed during the SCHEMA_UPGRADE phase due to: org/springframework/core/JdkVersion
com.atlassian.confluence.upgrade.UpgradeException: Upgrade task com.atlassian.confluence.upgrade.upgradetask.Hibernate5ConstraintNamesPreSchemaUpgradeTask@7b93a3fc failed during the SCHEMA_UPGRADE phase due to: org/springframework/core/JdkVersion
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:407)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:429)
...
Caused by: java.lang.NoClassDefFoundError: org/springframework/core/JdkVersion
Cause
It may happen due to the presence of conflicting .jar files in the <confluence-install>/confluence/WEB-INF/lib directory that are not bundled with Confluence on a fresh installation.
The aforementioned error was caused by the presence of spring-jdbc-2.5.6.SEC03.jar in the <confluence-install>/confluence/WEB-INF/lib directory. This file doesn't exist on a fresh installation of Confluence.
Solution
Compare the existing installation folder with another, same version, that you can get in Confluence Download Archives. Confirm if any .jar file was added and move it to another location. Then, try restarting the Confluence service and check if the upgrade completes as expected.