Custom Plugins using atlassian-renderer fails with "java.lang.NoClassDefFoundError: org/cyberneko/html/parsers/DOMFragmentParser" on Jira version 9.10 and above

XMLWordPrintable

    • 9.1
    • 2
    • Severity 2 - Major
    • 20

      Issue Summary

      This is reproducible on Data Center: yes

      Custom Plugins using the atlassian-renderer functionality fails with below Error:-

      java.lang.NoClassDefFoundError: org/cyberneko/html/parsers/DOMFragmentParser
      at com.atlassian.renderer.wysiwyg.converter.DefaultWysiwygConverter.convertXHtmlToWikiMarkup(DefaultWysiwygConverter.java:346) 
      

      This Error is seen in Jira Software Version starting from 9.10 or Jira Service Management Version starting from 5.10

      • Before JIRA 9.10 there were 2 JAR files for nekohtml located in:
      /WEB-INF/lib/nekohtml-1.9.19.jar
      /WEB-INF/atlassian-bundled-plugins/nekohtml-1.9.12-1.jar
      • From JIRA 9.10 there is only single JAR file in below location. It is because nekohtml library was bumped due to a vulnerability
      /WEB-INF/atlassian-bundled-plugins/nekohtml-1.9.22-2.jar 

      Due to this, Plugins using the atlassian-renderer functionality fails with above NoClassDefFoundError.

      Steps to Reproduce

      1. Install Jira version 9.12.x
      2. Install Scriptrunner plugin
      3. Run a script like below from Scriptrunner Console
        Jira Administration>Scriptrunner>Console
        import com.atlassian.renderer.wysiwyg.converter.DefaultWysiwygConverter
        String txtHtml = """ <ul><li>1</li><li>2</li><li>3</li></ul>  """
        return new  DefaultWysiwygConverter().convertXHtmlToWikiMarkup(txtHtml); 
      1. Error like below is observed

      Expected Results

      The script should run fine without the Error.

      Actual Results

      The below exception is thrown in the atlassian-jira.log file:

      java.lang.NoClassDefFoundError: org/cyberneko/html/parsers/DOMFragmentParser at com.atlassian.renderer.wysiwyg.converter.DefaultWysiwygConverter.convertXHtmlToWikiMarkup(DefaultWysiwygConverter.java:346)  

      Workaround

      As a workaround,

      • Copy the nekohtml-1.9.22-2.jar" from location $JIRA_INSTALL/atlassian-jira/WEB-INF/atlassian-bundled-plugins/  to  $JIRA_INSTALL/atlassian-jira/WEB-INF/lib which resolves the issue.

       

      Note- The issue is already fixed in JIRA 10.X version where newer version of atlassian-renderer (9.0.3) is used and above script executes fine. A similar version of atlassian-renderer is required for Jira 9.x version.

            Assignee:
            Daniel Rauf
            Reporter:
            Karan Ahuja
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: