Template NullPointerException when visiting Confluence after space import
Platform Notice: Server, Data Center, and Cloud By Request - This article was written for the Atlassian server and data center platforms but may also be useful for Atlassian Cloud customers. If completing instructions in this article would help you, please contact Atlassian Support and mention it.
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
Problem
After importing a space, a user may see the following error when visiting Confluence:
Error occurred during template rendering: Invocation of method 'getRenderedParam' in class
com.atlassian.plugin.web.model.DefaultWebParam threw exception java.lang.NullPointerException at
template/includes/menu-macros.vm[line 67, column 50]. Contact your administrator for assistance.
Diagnosis
Environment
- Confluence 5.7
- Other versions of Confluence may be affected
Diagnostic Steps
Run the following command against the database.
select * from spaces where spacename is NULL;
- If results are returned, please proceed below.
Cause
A space has been imported into Confluence that has no Space Name. CONFSERVER-39517 - Space Imports with SpaceName the same as SpaceKey cause Template NullPointerException
Resolution
Change Space Name
- Open your Confluence instance;
- Go to Space > Space Directory;
- Look for spaces with the name set as 'Undefined';
Change the space name.
Modify Data
- Stop Confluence
In the database, run:
update spaces set spacename='SPACE_NAME' where spaceid=XXXXXX;
Always back up your data before performing any modifications to the database. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.
Where
XXXXXX
is thespaceid
from the results returned in your Diagnosis, and theSPACE_NAME
is set to the desired space name.Start Confluence
- Rebuild the search index