Jira server fails to start or functionality fails with ClassNotFoundException in logs
Symptoms
A JIRA application instance may encounter one of the below situations:
- The application may fail to start.
- Operations may throw a stack trace with a
ClassNotFoundException
orNoSuchMethodException
.
A stacktrace like the following appears in the atlassian-jira.log
:
ERROR [500ErrorPage.jsp] Exception caught in 500 page com.atlassian.util.concurrent.LazyReference$InitializationException: java.lang.NoClassDefFoundError: com/opensymphony/user/User
com.atlassian.util.concurrent.LazyReference$InitializationException: com.atlassian.util.concurrent.LazyReference$InitializationException: java.lang.NoClassDefFoundError: com/opensymphony/user/User
...
Caused by: java.lang.ClassNotFoundException: com.opensymphony.user.User
...
Note that any ClassNotFoundException
or NoSuchMethodException
has in general the same root cause.
Diagnosis
Carefully analyse the atlassian-jira.log
file to identify the plugin that is causing these exceptions. Search the logs for the strings ClassNotFound
, NoClassDefFound
, or NoSuchMethod
.
In those stacktraces having a closer look at the reported class names will help to identify the plugin that is causing these error.
Example 1
Exception:
Caused by: java.lang.ClassNotFoundException: Class 'com.xiplink.jira.git.revisions.RevisionIndexService' not found.
Above this line, the below error can be noticed:
2012-03-08 18:05:37,424 main ERROR [atlassian.jira.service.OfBizServiceConfigStore] Unable to create a service config for service with the name : Git Revision Indexing Service
This is the JIRA Git plugin which can be identified from the ERROR statement as well as the class name com.xiplink.jira.git.revisions.RevisionIndexService
Example 2
Exception:
Caused by: java.lang.NoClassDefFoundError: com/opensymphony/user/User
Above this line, the below error can be noticed:
2012-03-08 18:36:40,666 Spring executor 20 ERROR [plugin.osgi.factory.OsgiPlugin] Unable to start the Spring context for plugin is.origo.jira.tempo-plugin
This is the Tempo Plugin.
Example 3
Exception:
Caused by: java.lang.NoSuchMethodError: com.atlassian.jira.issue.customfields.searchers.DateTimeRangeSearcher.
Above this line, the below error can be noticed:
The data before the upgrade has been exported to /var/atlassian/application-data/jira/export/jira_autoexport_20130612_052939.zip 2013-06-12 05:30:37 error
Exception thrown during upgrade: java.lang.NoSuchMethodError: com.atlassian.jira.issue.customfields.searchers.DateTimeRangeSearcher.
This is the Charting plugin
Example 4
Exception:
Caused by: java.lang.NoClassDefFoundError: com/atlassian/jira/component$ComponentAccessor
By checking the error stack trace we can see error is triggered during issue transition
java.lang.NoClassDefFoundError: com/atlassian/jira/components$ComponentAccessor
at script_6f327eea0a9698adebfd6f688ce968bd.run(script_6f327eeaa9698adebfd6f688ce968bd
at com.innovalog.groovy.GroovyExpression.eval(Groovy Expression.java:193) [?:?]
at com.innovalog.groovy.GroovyExpression.eval(GroovyExpression.java: 140) [?:?]
at com.innovalog.jmwe.plugins.validators.GroovyValidator.doValidate(GroovyValidator.java)
at com.innovalog.jmwe.plugins.validators.GenericValidator.validate(GenericValidator.java)
at com.atlassian.jira.workflow.SkippableValidator.validate(SkippableValidator.java:45)
at com.opensymphony.workflow.AbstractWorkflow.verifyInputs(AbstractWorkflow.java: 1466)
at com.opensymphony.workflow.AbstractWorkflow.transitionWorkflow(AbstractWorkflow.java)
This is the JMWE plugin
By following the above procedure, in most of the cases the plugin that needs to be upgraded or removed can be identified.
Cause
A plugin is installed in the instance that is no longer compatible with the upgraded application version.
Note that there may be some alternative causes, especially with JIRA applications EAR/WAR installation. See also NoClassDefFoundError in Tomcat EAR-WAR.
Resolution
- Stop JIRA
- Go to your the
$JIRA-Home/plugins/installed-plugins
directory Rename the
$JIRA-Home/plugins/installed-plugins
directory to$JIRA-Home/plugins/installed-plugins2
- Restart JIRA - This will re-create the the
$JIRA-Home/plugins/installed-plugins
directory but JIRA will start without any plugins - If the issue is no longer reproducible, Reinstall the add-on with the latest version through the Administration > Add-ons > Find new add-ons page.
You may later delete the $JIRA-Home/plugins/installed-plugins2 directory which is no longer in use.
Note that the later versions of JIRA applications natively bundles some plugins which were optional in the earlier versions. This can be checked by expanding the 'System Plugins' in the Universal Plugin Manager.