Could not access Space directory
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. 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.
*Except Fisheye and Crucible
Symptoms
When clicking Browse >> Space Directory, the returned page does not display in a web browser and the following appears in the atlassian-confluence.log
:
ERROR [http-8090-2] [opensymphony.webwork.dispatcher.VelocityResult] doExecute Unable to render Velocity Template, '/templates/spacedirectory.vm'
-- url: /spacedirectory/view.action | userName: adam | referer: http://sentinel:8090/dashboard.action | action: view
org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getLogoDownloadPath' in class com.atlassian.confluence.plugins.spacedirectory.ViewSpaceDirectoryAction threw exception java.lang.NullPointerException at /templates/spacedirectory.vm[line 65, column 59]
at org.apache.velocity.runtime.parser.node.ASTMethod.handleInvocationException(ASTMethod.java:337)
at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:284)
at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:262)
...
And,
ERROR [http-8090-4] [opensymphony.webwork.dispatcher.VelocityResult] doExecute Unable to render Velocity Template, '/templates/spacedirectory.vm'
-- referer: http://192.168.84.245:8090/dashboard.action | url: /spacedirectory/view.action | userName: peter.ko | action: view
org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getBodyAsString' in class com.atlassian.confluence.spaces.SpaceDescription$$EnhancerByCGLIB$$ee053320 threw exception java.lang.UnsupportedOperationException: The body of this ContentEntityObject ('') was 'BodyType:XHTML' but was expected to be 'BodyType:WIKI' at /templates/spacedirectory.vm[line 79, column 75]
Cause1
This issue is caused by a corrupted index. Confluence is trying to fetch information about the spaces from the available index, and then retrieve the data from the database. Some of the spaces referenced in the index could not be found in the database, thus this error thrown.
Cause 2
This error occurs for new installations of 4.0.3, and not getting fixed by upgrade. This is tracked: CONF-24282
Resolution 1
Since the issue is caused by corrupted index, rebuilding the index from scratch should solve the issue.
Resolution 2
As a workaround you may:
1- Open this URL in your browser: <Confluence-URL>/admin/force-upgrade.action
2- Select *changeSpaceDescriptionsBodyTypeUpgradeTask* in the Upgrade task to run dropdown list.
3- Choose Force Upgrade.