Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-72156

ClassNotFoundException/NoClassDefFoundError (related to EventTriggerRuleComponent) is thrown when (some) apps are installed before Automation for Jira

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Medium
    • None
    • 7.2.8, 7.3.5
    • Java API

    Description

      Issue Summary

      ClassNotFoundException/NoClassDefFoundError (related to the component EventTriggerRuleComponent or AutomationRuleComponent) is thrown when (some) apps are installed before Automation for Jira is installed or upgraded.

      This has been found with:

      • Third party sample app
      • ProForma: Forms and Fields for Jira
      • Profields - Jira Project Tracking

      Steps to Reproduce

      1. Build the attached "automation-thirdparty-sample-modified.zip" project. It is a trivially modified version of the official Automation sample app provided by Atlassian (https://bitbucket.org/atlassian/automation-addon-sample/src/master/automation-thirdparty-sample/).
        • LegacySampleCommentUpgradeTask class was removed to avoid an error during installation.
        • Marked the asterisk as optional in Import-Package to avoid this problem: JRASERVER-71831.
        • Compare the "pom.xml" with the original one to see some other minor differences.
        • Note: use "-Denforcer.skip=true" to avoid a build error with "atlas-package".
      2. Install the modified sample app in Jira.
      3. Install Automation for Jira.
      4. "ClassNotFoundException: com.codebarrel.automation.api.thirdparty.EventTriggerRuleComponent not found" appears in the Jira log, but the installation is successful.
      5. Create a new automation rule. Use trigger type "Issue commented" and add one "Log action" action with arbitrary message.
      6. Add a comment to an issue.
      7. "java.lang.NoClassDefFoundError: com/codebarrel/automation/api/thirdparty/EventTriggerRuleComponent" error appears in the audit log and the Jira log.
      8. Uninstall the modified sample app.
      9. Install the modified sample app.
      10. Add a comment to an issue.
      11. The rule is executed without error.

      Expected Results

      The third-party sample app and Automation for Jira can be installed in any order, no exceptions, automation rules are executed successfully.

      Actual Results

      When the third-party sample app is installed before Automation for Jira, the 3 symptoms below will (or might) be observed:

      Symptom 1:

      All automation rules will fail

      Symptom 2:

      The Jira application logs will be flooded with the following ClassNotFoundException error:

      2022-11-15 09:33:13,212+0000 https-jsse-nio2-8443-exec-829 url: /browse/ABC-123, /secure/ProjectIssueNavigatorAction!issueViewWithSidebar.jspa; user: XXXXXX ERROR XXXXXX XXXxXXXXXXXXxXXX XXXXX XX.XX.XX.XX /browse/ABC-123 [c.a.event.internal.AsynchronousAbleEventDispatcher] There was an exception thrown trying to dispatch event [com.atlassian.jira.web.analytics.WebPanelRenderTimeEvent@508a3a88] from the invoker [SingleParameterMethodListenerInvoker{method=public void com.codebarrel.jira.plugin.automation.event.JiraIssueEventListenerImpl.handleAllOtherEvents(java.lang.Object), listener=com.codebarrel.jira.plugin.automation.event.JiraIssueEventListenerImpl@5ad1ed}]
      java.lang.RuntimeException: com/codebarrel/automation/api/thirdparty/EventTriggerRuleComponent. Listener: com.codebarrel.jira.plugin.automation.event.JiraIssueEventListenerImpl event: com.atlassian.jira.web.analytics.WebPanelRenderTimeEvent
      	at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:53)
      	at com.atlassian.event.internal.AsynchronousAbleEventDispatcher.lambda$null$0(AsynchronousAbleEventDispatcher.java:37)
      	at com.atlassian.jira.event.JiraEventExecutorFactory$1.lambda$execute$0(JiraEventExecutorFactory.java:47)
      	at com.atlassian.jira.util.thread.JiraThreadLocalUtils.lambda$wrap$1(JiraThreadLocalUtils.java:156)
      	at com.atlassian.jira.event.JiraEventExecutorFactory$CallerRunsAlways.rejectedExecution(JiraEventExecutorFactory.java:87)
      	at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:830)
      	at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1379)
      	at com.atlassian.jira.event.JiraEventExecutorFactory$1.execute(JiraEventExecutorFactory.java:42)
      	at com.atlassian.event.internal.AsynchronousAbleEventDispatcher.dispatch(AsynchronousAbleEventDispatcher.java:85)
      	at com.atlassian.event.internal.LockFreeEventPublisher$Publisher.dispatch(LockFreeEventPublisher.java:220)
      
      ...
      
      	at com.atlassian.jira.servermetrics.MetricsCollectorFilter.doFilter(MetricsCollectorFilter.java:25)
      	... 30 filtered
      	at sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:126)
      	at sun.nio.ch.Invoker$2.run(Invoker.java:218)
      	at sun.nio.ch.AsynchronousChannelGroupImpl$1.run(AsynchronousChannelGroupImpl.java:112)
      	at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
      	at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
      	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      	at java.lang.Thread.run(Thread.java:748)
      Caused by: java.lang.NoClassDefFoundError: com/codebarrel/automation/api/thirdparty/EventTriggerRuleComponent
      	at java.lang.ClassLoader.defineClass1(Native Method)
      	at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
      	at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.defineClass(BundleWiringImpl.java:2410)
      
      ... 
      
      Caused by: java.lang.ClassNotFoundException: com.codebarrel.automation.api.thirdparty.EventTriggerRuleComponent not found by com.deiser.jira.profields [201]
      	at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1639)
      	at org.apache.felix.framework.BundleWiringImpl.access$200(BundleWiringImpl.java:80)
      	at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2053)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      

      Symptom 3:

      The Jira application might observe slowness/performance issues, due to the huge amount of logs being recorded using the log4j class. A lot of HTTP threads might end up in the BLOCKED status trying to write into the log files, waiting for a lock help by another thread also trying to write into the same log files. Example of stack trace of a BLOCKED thread:

      org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:231)
      com.atlassian.jira.logging.JiraHomeAppender.doAppend(JiraHomeAppender.java:206)
      org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:69)
      org.apache.log4j.Category.callAppenders(Category.java:219)
      org.apache.log4j.Category.forcedLog(Category.java:402)
      org.apache.log4j.Category.log(Category.java:869)
      org.slf4j.impl.Log4jLoggerAdapter.error(Log4jLoggerAdapter.java:562)
      com.atlassian.plugin.module.PrefixDelegatingModuleFactory.createModule(PrefixDelegatingModuleFactory.java:91)
      
      ...
      
      com.codebarrel.jira.plugin.automation.thirdparty.ThirdPartyComponentModuleDescriptor.getModule(ThirdPartyComponentModuleDescriptor.java:57)
      com.codebarrel.jira.plugin.automation.thirdparty.ThirdPartyComponentModuleTracker.getHandledEventClasses(ThirdPartyComponentModuleTracker.java:58)
      com.codebarrel.jira.plugin.automation.thirdparty.ThirdPartyComponentModuleTracker.lambda$getThirdPartyTriggers$0(ThirdPartyComponentModuleTracker.java:53)
      com.codebarrel.jira.plugin.automation.thirdparty.ThirdPartyComponentModuleTracker$$Lambda$18153/1421662149.test(Unknown Source)
      

      Workaround

      • Reinstall the interfering app.
        There should be no data/configuration loss as all the information is stored in the Jira database which is not affected by the reinstall.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              dmorrow@atlassian.com Dugald Morrow
              Votes:
              16 Vote for this issue
              Watchers:
              18 Start watching this issue

              Dates

                Created:
                Updated: