Creating a page in Confluence shows a blank nonfunctional editor and user Drafts page throws an error

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

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.

*Fisheye および Crucible は除く

 

要約

A user tries to create a new page, the editor displays only a blank page and no further action is available in the editor causing the user to not be able to create new pages:

The same user tries to access its Drafts page receives the following NullPointer error message:


The problem resides in a draft with unexpected values in the content table (database). This article will explain how we can remove the problematic draft to resolve the problem. 

環境

This problem was identified in Confluence server and datacenter version 7.4.3. It could also affect other versions of Confluence.



診断

Trying to create a new page shows a blank page and no further action is available rendering the editor useless. The following error can be found in the atlassian-confluence.log file:

2021-05-04 19:36:50,308 ERROR [http-nio-8080-exec-41 url:/pages/createpage.action username:test] [confluence.util.velocity.VelocityUtils] writeRenderedTemplate Error occurred rendering template: templates/atlassian-editor.vm
 -- referer: https://confluence.com/pages/createpage.action?spaceKey=TEST&fromPageId=510827999 | url: /pages/createpage.action | traceId: 34b3cc2025c1660d | userName: test | action: createpage
org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getRenderedTemplateHtml' in  class com.atlassian.confluence.plugins.soy.VelocityFriendlySoyTemplateRenderer threw exception com.google.template.soy.tofu.SoyTofuException: When evaluating "getText('draft.warning.create.page.without.title', formatDateTime($existingDraft.lastModificationDate))": While computing function "formatDateTime($existingDraft.lastModificationDate)": null at templates/atlassian-editor.vm[line 479, column 36]
...
Caused by: com.google.template.soy.tofu.SoyTofuException: When evaluating "getText('draft.warning.create.page.without.title', formatDateTime($existingDraft.lastModificationDate))": While computing function "formatDateTime($existingDraft.lastModificationDate)": null...Caused by: com.google.template.soy.sharedpasses.render.RenderException: While computing function "formatDateTime($existingDraft.lastModificationDate)": null

There's a rendering problem due to a null value in the lastModificationDate column in the content table related to a draft:

RenderException: While computing function "formatDateTime($existingDraft.lastModificationDate)": null

Double-check in the database by querying based on the affected user and space(s):

select * from content 
where contenttype = 'DRAFT' 
and draftspacekey = 'TEST'
and lastmoddate is null 
and creator in (select user_key from user_mapping where username = 'test');

Both the draftspacekey and username can be found in the aforementioned log error and updated accordingly. 

To further confirm that we're experiencing the problem reported in this article, follow the steps below:

  1. As a Confluence administrator, confirm that Collaborative Editing is OFF.
  2. As a Confluence administrator, we can impersonate the user with the free app User Switcher for Confluence or ask the affected user(s) to check their Drafts page.
  3. With the user logged in, click in its user profile at the top right corner (avatar) >> Drafts
  4. This page weill error out in the UI confirming that the problem is with the drafts.
  5. Confirm the time this was performed and double-check in the atlassian-confluence.log file for the error 

This issue may affect one or more users and one or more spaces. It's possible that the problem only occurs with Collaborative Editing disabled. Re-enabling Collaborative Editing won't fix this.


原因

There's a rendering problem due to a null value in the lastModificationDate column in the content table related to a draft:

RenderException: While computing function "formatDateTime($existingDraft.lastModificationDate)": null

ソリューション

Deleting the drafts from the UI isn't possible so we have two options, REST API or via SQL query.

REST API

  1. The SQL query from the diagnose section will contain the contentid of the problematic drafts that we're going to use in the REST API call
  2. Update the following command accordingly to your site configuration and query results:
curl -u <username>:<password> -v -X DELETE "http://<confluenceURL>/rest/api/content/<contentid>?status=draft" | python -mjson.tool

The verbose flag is to assist in case the command fails to run


SQL クエリ

  1. The SQL query from the diagnose section will be used as a sub-query for the delete script
  2. Schedule a time to shutdown Confluence and backup the database
    1. It's recommended to perform this in a staging environment first before applying to a production site
  3. Download, update the .sql file accordingly to the affected space and user. Run it

    Delete queries
    DELETE FROM NOTIFICATIONS WHERE CONTENTID IN (select contentid from content 
    where contenttype = 'DRAFT' 
    and draftspacekey = '<spacekey>'
    and lastmoddate is null 
    and creator in (select user_key from user_mapping where username = '<username'));
    DELETE FROM CONFANCESTORS WHERE ANCESTORID IN (select contentid from content 
    where contenttype = 'DRAFT' 
    and draftspacekey = '<spacekey>'
    and lastmoddate is null 
    and creator in (select user_key from user_mapping where username = '<username'));
    DELETE FROM CONFANCESTORS WHERE DESCENDENTID IN (select contentid from content 
    where contenttype = 'DRAFT' 
    and draftspacekey = '<spacekey>'
    and lastmoddate is null 
    and creator in (select user_key from user_mapping where username = '<username'));
    DELETE FROM BODYCONTENT WHERE CONTENTID IN (select contentid from content 
    where contenttype = 'DRAFT' 
    and draftspacekey = '<spacekey>'
    and lastmoddate is null 
    and creator in (select user_key from user_mapping where username = '<username'));
    DELETE FROM CONTENTPROPERTIES WHERE CONTENTID IN (select contentid from content 
    where contenttype = 'DRAFT' 
    and draftspacekey = '<spacekey>'
    and lastmoddate is null 
    and creator in (select user_key from user_mapping where username = '<username'));
    DELETE FROM CONTENTPROPERTIES WHERE CONTENTID IN
    (select contentid from CONTENT where PAGEID in 
    (select contentid from content
    where contenttype = 'DRAFT'
    and draftspacekey = '<spacekey>'
    and lastmoddate is null
    and creator in (select user_key from user_mapping where username = '<username')));
    DELETE FROM LINKS WHERE CONTENTID IN (select contentid from content 
    where contenttype = 'DRAFT' 
    and draftspacekey = '<spacekey>'
    and lastmoddate is null 
    and creator in (select user_key from user_mapping where username = '<username'));
    DELETE FROM CONTENT_LABEL WHERE contentid IN (select contentid from content 
    where contenttype = 'DRAFT' 
    and draftspacekey = '<spacekey>'
    and lastmoddate is null 
    and creator in (select user_key from user_mapping where username = '<username'));
    DELETE FROM usercontent_relation WHERE targetcontentid IN (select contentid from content 
    where contenttype = 'DRAFT' 
    and draftspacekey = '<spacekey>'
    and lastmoddate is null 
    and creator in (select user_key from user_mapping where username = '<username'));
    DELETE FROM likes WHERE CONTENTID IN (select contentid from content 
    where contenttype = 'DRAFT' 
    and draftspacekey = '<spacekey>'
    and lastmoddate is null 
    and creator in (select user_key from user_mapping where username = '<username>'));
    DELETE FROM IMAGEDETAILS WHERE ATTACHMENTID IN
    (select contentid from CONTENT where PAGEID in 
    (select contentid from content
    where contenttype = 'DRAFT'
    and draftspacekey = '<spacekey>'
    and lastmoddate is null
    and creator in (select user_key from user_mapping where username = '<username')));
    DELETE FROM CONTENT_PERM WHERE ID IN (select contentid from content 
    where contenttype = 'DRAFT' 
    and draftspacekey = '<spacekey>'
    and lastmoddate is null 
    and creator in (select user_key from user_mapping where username = '<username'));
    DELETE FROM CONTENT_PERM_SET WHERE ID IN (select contentid from content 
    where contenttype = 'DRAFT' 
    and draftspacekey = '<spacekey>'
    and lastmoddate is null 
    and creator in (select user_key from user_mapping where username = '<username'));
    DELETE FROM CONTENT WHERE PAGEID IN (select contentid from content
    where contenttype = 'DRAFT'
    and draftspacekey = '<spacekey>'
    and lastmoddate is null
    and creator in (select user_key from user_mapping where username = '<username'));
    DELETE FROM CONTENT WHERE CONTENTID IN (select contentid from content 
    where contenttype = 'DRAFT' 
    and draftspacekey = '<spacekey>'
    and lastmoddate is null 
    and creator in (select user_key from user_mapping where username = '<username'));
  4. Restart Confluence and check the problem


最終更新日 2021 年 6 月 23 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.