An error occurred while searching for spaces in Space Directory after Importing a Space Backup into Confluence
プラットフォームについて: 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 は除く
要約
The message "An error occurred while searching for spaces." is thrown when accessing the space directory after a space import is run.
環境
- Confluence Server または Data Center
- A space was recently imported
診断
Reviewing <home-directory>/logs/atlassian-confluence.log
an error like such will be displayed:
Note "spacedirectory/view.action" in the referer shows the space directory is being loaded
2020-08-21 13:48:58,780 ERROR [http-nio-6702-exec-1] [common.error.jersey.ThrowableExceptionMapper] toResponse Uncaught exception thrown by REST service: The body of this ContentEntityObject ('') was 'BodyType:XHTML' but was expected to be 'BodyType:WIKI'
-- referer: http://localhost:6702/c702/spacedirectory/view.action | url: /c702/rest/spacedirectory/1/search | traceId: 10fc4d197ff99f11 | userName: admin
java.lang.UnsupportedOperationException: The body of this ContentEntityObject ('') was 'BodyType:XHTML' but was expected to be 'BodyType:WIKI'
at com.atlassian.confluence.core.ContentEntityObject.getBodyContent(ContentEntityObject.java:275)
at com.atlassian.confluence.core.ContentEntityObject.getBodyAsString(ContentEntityObject.java:317)
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.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:84)
at com.atlassian.hibernate.adapter.proxy.JavassistLazyInitializer_ImplementV2Proxy.invoke(JavassistLazyInitializer_ImplementV2Proxy.java:68)
at com.atlassian.confluence.spaces.SpaceDescription_$$_jvsta6_15.getBodyAsString(SpaceDescription_$$_jvsta6_15.java)
at com.atlassian.confluence.plugins.spacedirectory.rest.DefaultSpaceDirectoryEntityBuilder.build(DefaultSpaceDirectoryEntityBuilder.java:84)
at com.atlassian.confluence.plugins.spacedirectory.rest.SpaceDirectoryResource.doSearch(SpaceDirectoryResource.java:94)
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 com.atlassian.plugins.rest.common.interceptor.impl.Dis
....
原因
The spacedescription from the imported space has a differing bodytypeid in the bodycontent table than the existing spaces.
When a page has multiple bodytypeid ids in its bodycontent, Confluence is unable to render the page.
ソリューション
データベースを変更する前には必ずデータをバックアップするようにします。
- Confluence を停止します。
- Backup Confluence and the database.
Run the following query
UPDATE bodycontent SET bodytypeid = 0 WHERE contentid in (SELECT DISTINCT content.contentid FROM content INNER JOIN bodycontent on content.contentid = bodycontent.contentid where contenttype = 'SPACEDESCRIPTION' and bodytypeid != 0);
- Start Confluence