Dashboard is Not Shown Correctly with NullPointerException Due to Missing Space Description ID
Symptoms
The Recent Activity tabs, which include Popular and All Updates tab, are not shown in the correct location, as can be seen in the screen shot below:
The following appears in the atlassian-confluence.log
:
2013-02-07 17:48:52,662 ERROR [http-8435-7] [confluence.util.velocity.VelocityUtils] writeRenderedTemplate Error occurred rendering template: com/atlassian/confluence/plugins/macros/dashboard/global-entities.vm
-- referer: http://localhost:8435/conf/display/TEST/TEST+Home | url: /conf/dashboard.action | userName: admin | action: dashboard
org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getLogoDownloadPath' in class $Proxy112 threw exception java.lang.NullPointerException at com/atlassian/confluence/plugins/macros/dashboard/templates/space-list.vm[line 7, column 80]
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)
at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:342)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
....
Caused by: java.lang.NullPointerException
at com.atlassian.confluence.pages.AttachmentDownloadPathCache.toKey(AttachmentDownloadPathCache.java:36)
at com.atlassian.confluence.pages.CachingAttachmentManager.getAttachmentDownloadPath(CachingAttachmentManager.java:122)
....
Diagnosis
Run the following SQL query to find out if there are any spaces that contain a null Space Description ID:
SELECT * FROM SPACES WHERE SPACEDESCID IS NULL;
If the query returns one more rows, please proceed to the workaround
Cause
One or more spaces do not have Space Description defined in the database level
Workaround
Please backup your Confluence database before making any changes to your database.
Find the Problematic Space(s)
Run the following SQL query to find the problematic space(s). Please record the SPACEID for each spaces. We will refer this value as <spaceID>
in the subsequent queries below.
SELECT SPACEID, SPACEKEY FROM SPACES WHERE SPACEDESCID IS NULL;
Find the Missing Space Description ID
Replace <spaceID>
in this query with the value acquired from the previous step and execute the SQL query to find the missing space description ID:
SELECT CONTENTID FROM CONTENT WHERE CONTENTTYPE = 'SPACEDESCRIPTION' AND SPACEID = <spaceID>
If the query returns one row, please record the value for CONTENTID
(hereby referred as <contentID>
) and proceed to "Final Step". Otherwise, please continue.
If There is NO Space Description Defined
- Stop Confluence
Let's try to find the next
CONTENTID
, so that we can insert a space description row in theCONTENT
table. Please execute this query and record the value somewhere. We'll refer this value as<contentID>
in the subsequent queries for next steps.SELECT MAX(CONTENTID)+1 FROM CONTENT;
Replace
<contentID>
and<spaceID>
in this query with the values acquired from the previous steps. After that, run the SQL query to insert a new space description for the problematic space intoCONTENT
table:INSERT INTO CONTENT VALUES (<contentID>, 2, 'SPACEDESCRIPTION', NULL, NULL, 1, NULL, NOW(), NULL, NOW(), '', NULL, 'current', NULL, <spaceID>, NULL, NULL,NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
Find the next
BODYCONTENTID
, so that we can insert the space description itself intoBODYCONTENT
table. We'll refer this value as<bodycontentID>
in the subsequent query for next step.SELECT MAX(BODYCONTENTID)+1 FROM BODYCONTENT;
Replace
<bodycontentID>
and<contentID>
with the values acquired from the previous steps. After that, run this query to insert a new value intoBODYCONTENT
table:INSERT INTO BODYCONTENT VALUES (<bodycontentID>, '', <contentID>, 0);
Final Step
Replace
<contentID>
and<spaceID>
in the SQL query below with the values acquired from the previous steps. After that, run the query to update the Space Description ID:UPDATE SPACES SET SPACEDESCID = <contentID> WHERE SPACEID = <spaceID>;
- Restart Confluence or go to Confluence Admin > Cache Statistics and click Flush All