Uploaded image for project: 'Confluence Cloud'
  1. Confluence Cloud
  2. CONFCLOUD-75269

Importing a Space exported from Confluence Cloud into Confluence Data Center breaks template if it contains table

XMLWordPrintable

      Issue Summary

      After importing a Space exported from Confluence Cloud into Confluence Data Center, the templates that contains table cannot be edited because of parsing error. Also you cannot use these templates for creating new pages.

      Steps to Reproduce

      1. Create a fresh Space on the Confluence Cloud
      2. Create a new template on this newly created Space and put a simple table.
        Space Setting > Look and feel > Templates
      3. Save the template and export the Space.
      4. Import it to a Confluence Data Server instance. (I used Confluence 7.19.2 to reproduce this issue.)
      5. Go to Space tools > Content Tools > Templates and click 'Edit' button for the template that contains table in it.
      6. Try to save it without changing anything or try to create a page using this template.

      Expected Results

      The template should be saved or you can create page using this template without issues.

      Actual Results

      Edit/Save result:

      Page created by using this template result:

      The below exception is thrown in the atlassian-conflunce.log file during page creation:

      2023-02-02 12:14:09,962 ERROR [http-nio-27192-exec-9] [webwork.views.velocity.AbstractTagDirective] render Error processing tag: org.apache.velocity.exception.MethodInvocationException: Fatal exception caught while processing tag,  com.opensymphony.webwork.views.jsp.ui.ComponentTag at <unknown template>[line 0, column 0]
       -- referer: http://localhost:27192/c7192/pages/templates2/listpagetemplates.action?key=Sandbox | url: /c7192/pages/createpage-entervariables.action | traceId: 0078c2533dbf204e | userName: admin | action: createpage-entervariables
      org.apache.velocity.exception.MethodInvocationException: Fatal exception caught while processing tag,  com.opensymphony.webwork.views.jsp.ui.ComponentTag at <unknown template>[line 0, column 0]
          at com.opensymphony.webwork.views.velocity.AbstractTagDirective.processTag(AbstractTagDirective.java:355)
          at com.opensymphony.webwork.views.velocity.AbstractTagDirective.render(AbstractTagDirective.java:122)
          [...]
      Caused by: javax.servlet.jsp.JspException: Fatal exception caught in com.opensymphony.webwork.views.jsp.ui.ComponentTag tag class, doEndTag: Invocation of method 'getWysiwygContent' in  class com.atlassian.confluence.pages.actions.PageVariablesAction threw exception com.atlassian.confluence.content.render.xhtml.XhtmlParsingException: The XML content could not be parsed. There is a problem at line 1, column 190. Parser message: Undeclared namespace prefix &quot;ac&quot; (for attribute &quot;local-id&quot;)
       at [row,col {unknown-source}]: [1,190] at /template/aui/editor.vm[line 63, column 14]
          at com.opensymphony.webwork.views.jsp.ui.AbstractUITag.doEndTag(AbstractUITag.java:220)
          at com.opensymphony.webwork.views.velocity.AbstractTagDirective.processTag(AbstractTagDirective.java:349)
          ... 429 more
      Caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getWysiwygContent' in  class com.atlassian.confluence.pages.actions.PageVariablesAction threw exception com.atlassian.confluence.content.render.xhtml.XhtmlParsingException: The XML content could not be parsed. There is a problem at line 1, column 190. Parser message: Undeclared namespace prefix &quot;ac&quot; (for attribute &quot;local-id&quot;)
       at [row,col {unknown-source}]: [1,190] at /template/aui/editor.vm[line 63, column 14]
          at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:228)
          at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:262)
          at org.apache.velocity.runtime.parser.node.ASTReference.evaluate(ASTReference.java:470)
          at org.apache.velocity.runtime.parser.node.ASTExpression.evaluate(ASTExpression.java:62)
          at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:85)
          at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
          at org.apache.velocity.Template.merge(Template.java:328)
          at org.apache.velocity.Template.merge(Template.java:235)
          at com.opensymphony.webwork.views.jsp.ui.template.VelocityTemplateEngine.renderTemplate(VelocityTemplateEngine.java:52)
          at com.opensymphony.webwork.views.jsp.ui.AbstractUITag.mergeTemplate(AbstractUITag.java:427)
          at com.opensymphony.webwork.views.jsp.ui.AbstractUITag.doEndTag(AbstractUITag.java:216)
          ... 430 more
      Caused by: com.atlassian.confluence.content.render.xhtml.XhtmlParsingException: The XML content could not be parsed. There is a problem at line 1, column 190. Parser message: Undeclared namespace prefix &quot;ac&quot; (for attribute &quot;local-id&quot;)
       at [row,col {unknown-source}]: [1,190]
          at com.atlassian.confluence.content.render.xhtml.StaxUtils.convertToXhtmlException(StaxUtils.java:433)
          at com.atlassian.confluence.plugins.attachment.reconciliation.marshalling.UnknownAttachmentTransformerBase.transform(UnknownAttachmentTransformerBase.java:64)
          at com.atlassian.confluence.plugins.attachment.reconciliation.marshalling.UnknownAttachmentTransformerEditorToStorage.transform(UnknownAttachmentTransformerEditorToStorage.java:30)
          at com.atlassian.confluence.content.render.xhtml.TransformerChain.transform(TransformerChain.java:33)
          at com.atlassian.confluence.content.render.xhtml.PluggableTransformerChain.transform(PluggableTransformerChain.java:39)
          at com.atlassian.confluence.content.render.xhtml.editor.DefaultEditorConverter.convert(DefaultEditorConverter.java:37)
          at com.atlassian.confluence.content.render.xhtml.DefaultFormatConverter.cleanEditorFormat(DefaultFormatConverter.java:159)
          at com.atlassian.confluence.pages.actions.AbstractPreviewPageAction.getWysiwygContent(AbstractPreviewPageAction.java:170)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498)
          at org.apache.velocity.runtime.parser.node.PropertyExecutor.execute(PropertyExecutor.java:142)
          at org.apache.velocity.util.introspection.UberspectImpl$VelGetterImpl.invoke(UberspectImpl.java:529)
          at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:198)
          ... 440 more
      Caused by: com.ctc.wstx.exc.WstxParsingException: Undeclared namespace prefix "ac" (for attribute "local-id")
       at [row,col {unknown-source}]: [1,190]
          at com.ctc.wstx.sr.StreamScanner.constructWfcException(StreamScanner.java:630)
          at com.ctc.wstx.sr.StreamScanner.throwParseError(StreamScanner.java:473)
          at com.ctc.wstx.sr.NsAttributeCollector.resolveNamespaces(NsAttributeCollector.java:180)
          at com.ctc.wstx.sr.NsInputElementStack.resolveAndValidateElement(NsInputElementStack.java:375)
          at com.ctc.wstx.sr.BasicStreamReader.handleStartElem(BasicStreamReader.java:2947)
          at com.ctc.wstx.sr.BasicStreamReader.nextFromTree(BasicStreamReader.java:2848)
          at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1019)
          at com.ctc.wstx.evt.WstxEventReader.peek(WstxEventReader.java:306)
          at com.ctc.wstx.evt.FilteredEventReader.peek(FilteredEventReader.java:120)
          at com.ctc.wstx.evt.FilteredEventReader.hasNext(FilteredEventReader.java:70)
          at com.atlassian.confluence.content.render.xhtml.XmlFragmentBodyEventReader.hasNext(XmlFragmentBodyEventReader.java:33)
          at com.atlassian.confluence.content.render.xhtml.transformers.DefaultFragmentTransformer.transform(DefaultFragmentTransformer.java:116)
          at com.atlassian.confluence.plugins.attachment.reconciliation.marshalling.UnknownAttachmentTransformerBase.transform(UnknownAttachmentTransformerBase.java:61)
          ... 453 more
      

      Workaround

      The issue here is caused by the below part of the table XHTML element coming from the Cloud storage format:

      [...]
      <table data-layout="default" ac:local-id="ef24f0d4-4f2d-4fca-8433-e5421c85ff9f">
      [...]
      

      Data Center cannot parse the ac:local-id element and gives an error as this is an undeclared namespace. To fix the issue, we can remove the ac: part from the templates.

      If you have a few templates that have this issue, you can edit their storage format by using Source Editor app.

      1. Navigate to Templates and click 'Edit' for the problematic template.
      2. When you are in Edit mode, you will notice < > at the top left of the page. Click it.
      3. It opens a panel where you can see the storage format of the template and from there locate the table element that contains ac:local-id.
      4. Remove the ac: part only and save the template. If you have multiple tables on the same template, please do it for all of them.

      If you have several templates that are affected by this issue, we can remove the problematic part by running an UPDATE query.

      Please back up the Confluence Database before making any changes and test on a staging server first, if possible. Ensure that Confluence is not running during the database modification to avoid potential data inconsistency.

      • Postgres
        UPDATE pagetemplates
        SET content = REPLACE(content, 'ac:local-id', 'local-id')
        WHERE prevver is null and lower(content) like '%ac:local-id%';
        

      After running this, restart Confluence and check the status of the templates.

        1. cloud-template.jpg
          cloud-template.jpg
          64 kB
        2. dc-page-create-error.jpg
          dc-page-create-error.jpg
          55 kB
        3. dc-template-save-error.jpg
          dc-template-save-error.jpg
          119 kB

              Unassigned Unassigned
              9f7de485df51 Basar Beykoz (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated: