Copying a Space fails due to ConflictException related with a null JsonContentProperty
プラットフォームについて: Data Center - この記事は、Data Center プラットフォームのアトラシアン製品に適用されます。
このナレッジベース記事は製品の Data Center バージョン用に作成されています。Data Center 固有ではない機能の Data Center ナレッジベースは、製品のサーバー バージョンでも動作する可能性はありますが、テストは行われていません。サーバー*製品のサポートは 2024 年 2 月 15 日に終了しました。サーバー製品を利用している場合は、アトラシアンのサーバー製品のサポート終了のお知らせページにて移行オプションをご確認ください。
*Fisheye および Crucible は除く
要約
When a space administrator copies a space, it fails asking you to retry the copying process without further error details.
環境
Confluence 8.5.X. an later
診断
In the atlassian-confluence.log
files, the following error can be found when searching for the related Copy space long running task entries:
2024-04-01 07:13:11,929 ERROR [Long running task: Copy space long running task] [dao.bulk.copy.DefaultBulkPageCopy] safeAction An exception occurred while trying to do a bulk page copy operation
-- url: /confluence/rest/copy/1.0/copy | userName: admin | referer: https://CONFLUENCE_URL/confluence/spaces/copyspaceoptions.action?key=ABCDEF | traceId: 334199d4dd67b04f
com.atlassian.confluence.api.service.exceptions.ConflictException: Cannot create new content property: JsonContentProperty{id='null', key='contentpropertyname-1', content=CollapsedReference{idProperties={id=ContentId{id=1037697302}, status=current, version=CollapsedReference{idProperties={number=1}, referentClass=class com.atlassian.confluence.api.model.content.Version}}, referentClass=class com.atlassian.confluence.api.model.content.Content}, version=null}: [SimpleMessage{key='jsonproperty.duplicate.key', args=[], translation='null'}]
at com.atlassian.confluence.api.model.validation.SimpleValidationResult.convertToServiceException(SimpleValidationResult.java:84)
at com.atlassian.confluence.api.model.validation.ValidationResult.throwIfNotSuccessful(ValidationResult.java:197)
at com.atlassian.confluence.plugins.contentproperty.ContentPropertyServiceImpl.create(ContentPropertyServiceImpl.java:63)
at com.atlassian.confluence.plugins.contentproperty.ContentPropertyServiceImpl.copyAllJsonContentProperties(ContentPropertyServiceImpl.java:105)
at jdk.internal.reflect.GeneratedMethodAccessor3976.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
...
...
原因
In the table CONTENTPROPERTIES, this specific page that trigger the error has two different rows with the same version value for the "contentpropertyname-1" key. Hence, when the page is copied, the 'jsonproperty.duplicate.key' is triggered as one single page should not have a duplicate version of the same contentproperty
ソリューション
In order to address this issue, please follow the steps outlined here:
Run the following SQL statement to identify all the pages that contain a duplicate contentproperty entry:
SELECT c.pageid FROM content AS c JOIN bodycontent AS b ON c.contentid = b.contentid WHERE c.contenttype = 'CUSTOM' AND c.title = '<CONTENTPROPERTYNAME_1>' GROUP BY c.pageid,c.version HAVING COUNT(*) > 1
Replace the value of
<CONTENTPROPERTYNAME_1>
with the content property name indicated in the error found earlierOnce you have identified the pages with duplicated entries, execute the following
curl
command to delete the content property of that specific PAGEID:curl -i -u admin:admin -X DELETE "http://CONFLUENCE_HOST/confluence/rest/api/content/PAGE_ID/property/contentpropertyname-1"
Replace the variables
CONFLUENCE_HOST
andPAGE_ID
with the correspondent values.
You may find several pages affected by this same situation, if that's the case, removed those related to the specific space you are copying.- When the entries are remove, retry the copy of your space.