Confluence page fails to render with 'java.lang.RuntimeException: Error rendering template for decorator root' due to null label
Problem
When attempting to view a page in Confluence it shows a System Error has occurred with a long stack trace.
The following appears in the atlassian-confluence.log
2016-07-13 05:35:09,638 ERROR [http-nio-8090-exec-7] [opensymphony.webwork.dispatcher.VelocityResult] doExecute Unable to render Velocity Template, '/pages/viewpage.vm'
-- referer: https://confluence.mycompany.com/spaces/viewspacesummary.action?key=SKEY | url: /display/SKEY/Home | userName: admin | action: viewpage | page: 8945682
java.lang.RuntimeException: Error rendering template for decorator root
...
Caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getDisplayableItems' in class com.atlassian.confluence.plugin.descriptor.web.ConfluenceWebInterfaceManager threw exception net.sf.hibernate.LazyInitializationException: Failed to lazily initialize a collection at template/includes/menu-macros.vm[line 133, column 45]
...
Caused by: net.sf.hibernate.LazyInitializationException: Failed to lazily initialize a collection
at net.sf.hibernate.collection.PersistentCollection.initialize(PersistentCollection.java:201)
at net.sf.hibernate.collection.PersistentCollection.read(PersistentCollection.java:71)
...
Cause
The page has the Popular Label macro in use, but one of the labels has a null value in the label name.
Workaround
Confirm this is the problem:
select * from LABEL where NAME is null;
If you want to find details about the content that is using the label:
select CONTENTID from CONTENT_LABEL where LABELID = '<labelid-from-above>'; select * from CONTENT where CONTENTID = '<contentid-from-above>';
If there are any results, use the following to update the data where
<some-name>
is the name of the label:update LABEL set NAME = '<some-name>' where LABELID = <labelid-from-above>;
- Restart Confluence and go to the page that was causing the issue
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.