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:
- As a Confluence administrator, confirm that Collaborative Editing is OFF.
- 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.
- With the user logged in, click in its user profile at the top right corner (avatar) >> Drafts
- This page weill error out in the UI confirming that the problem is with the drafts.
- 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
- 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
- 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 クエリ
- The SQL query from the diagnose section will be used as a sub-query for the delete script
- Schedule a time to shutdown Confluence and backup the database
- It's recommended to perform this in a staging environment first before applying to a production site
Download, update the .sql file accordingly to the affected space and user. Run it.
- Restart Confluence and check the problem