Tomcat or Confluence logs are throwing java.lang.ClassNotFoundException or java.lang.NoClassDefFoundError errors
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
There are 'java.lang.ClassNotFoundException'
errors on the Confluence logs referring to missing classes, for example:
26-Aug-2020 08:38:15.069 SEVERE [http-nio-80-exec-3] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [dispatcher] in context with path [/synchrony-proxy] threw exception [Filter execution threw an exception] with root cause
java.lang.ClassNotFoundException: org.apache.commons.lang3.StringUtils
26-Aug-2020 08:38:30.522 SEVERE [http-nio-80-exec-5] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [dispatcher] in context with path [/synchrony-proxy] threw exception [Filter execution threw an exception] with root cause
java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils
The actual message on the logs may be different, depending on the specific class that is missing.
Confluence's functionality may also be affected in various ways, as a missing class could cause problems with specific aspects of the application.
Environment
Confluence Server or Data Center (any version).
Diagnosis
If the missing class is part of Confluence's core functionalities, it will be provided by a bundled JAR file that's included inside the application's Installation Directory.
As such, the cause of this error would be due to a missing JAR file, inside the current installation directory. To check this:
- Download the same version of Confluence that is currently installed, from the Download Archives page
- Choose the Standalone (zip or tar.gz version)
- Extract the downloaded file
- Compare the contents of both directories, to check for any differences between the default installation directory that was downloaded, and the current installation directory being used:
On Linux, you can use the diff command, for example:
diff -qr current_install_directory downloaded_install_directory | sort
- Look for any .jar files that are present on the downloaded (default) installation directory, but not on the current installation directory
Cause
The missing .jar file (or files) is the cause of the issue, as Confluence will attempt to load classes that are not present on the files inside its installation directory.
Solution
- Stop Confluence
- Copy any identified .jar files that are missing, from the downloaded installation directory, to the same location inside the current installation directory
- Start Confluence, so it can load the missing files upon startup