RuntimeException Error rendering template for decorator root in a Page
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
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
A stack trace error appears when visiting one or more pages, sometimes after an upgrade. The page may have been working fine previously. Not all pages are affected. The atlassian-confluence.log
file contains a stack trace similar to:
2010-04-08 11:35:24,597 ERROR [http-10.28.1.96-80-12] [atlassian.confluence.servlet.ConfluenceServletDispatcher] sendError Could not execute action
-- referer: http://confluenceURL/dashboard.action | url: /display/Spacekey/Home | userName: admin
java.lang.RuntimeException: Error rendering template for decorator root
at com.atlassian.confluence.setup.velocity.ApplyDecoratorDirective.render(ApplyDecoratorDirective.java:211)
at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
at org.apache.velocity.Template.merge(Template.java:328)
...
Caused by: java.lang.RuntimeException: Error rendering template for decorator page
at com.atlassian.confluence.setup.velocity.ApplyDecoratorDirective.render(ApplyDecoratorDirective.java:211)
at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175)
...
Caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getDisplayableLabel' in class com.atlassian.confluence.plugin.descriptor.web.model.ConfluenceWebLabel threw exception com.atlassian.core.exception.InfrastructureException: Error occurred rendering template content at template/includes/menu-macros.vm[line 132, column 36]
at org.apache.velocity.runtime.parser.node.ASTMethod.handleInvocationException(ASTMethod.java:337)
...
Caused by: com.atlassian.core.exception.InfrastructureException: Error occurred rendering template content
at com.atlassian.confluence.util.velocity.VelocityUtils.getRenderedContent(VelocityUtils.java:123)
at com.atlassian.confluence.util.velocity.VelocityUtils.getRenderedContent(VelocityUtils.java:106)
at com.atlassian.confluence.plugin.descriptor.web.ConfluenceWebFragmentHelper.renderVelocityFragment(ConfluenceWebFragmentHelper.java:57)
at com.atlassian.plugin.web.model.DefaultWebLabel.getDisplayableLabel(DefaultWebLabel.java:71)
at com.atlassian.confluence.plugin.descriptor.web.model.ConfluenceWebLabel.getDisplayableLabel(ConfluenceWebLabel.java:35)
...
Caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getLatestVersionsOfAttachments' in class com.atlassian.confluence.pages.Page$$EnhancerByCGLIB$$6a222880 threw exception net.sf.hibernate.LazyInitializationException: Failed to lazily initialize a collection at getRenderedContent[line 1, column 15]
at org.apache.velocity.runtime.parser.node.ASTMethod.handleInvocationException(ASTMethod.java:337)
...
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)
...
Caused by: net.sf.hibernate.HibernateException: collection was evicted
at net.sf.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:3303)
at net.sf.hibernate.collection.PersistentCollection.initialize(PersistentCollection.java:195)
... 282 more
Diagnosis
Run encoding test to see if there's an encoding issue (Troubleshooting Character Encodings).
Cause
The above error is a symptom and usually displays after the root cause error, which will be printed out to the atlassian-confluence.log
. Search for the root cause error that occurs before the first of the "Error rendering template for decorator root" error.
Occasionally the error can be thrown:
- When there is a compatibility issue with your custom layout.
- When there is corruption in the search index.
- When there is a StackOverFlow and the JVM crashes, due to a loop when using {excerpt} and {excerpt-include} macros
- When there is a viewfile macro linked to a corrupt document (ie xlsx, docx).
- Confluence is running on non UTF-8 encoding
Resolution
To resolve this problem,
- Try resetting the custom decorator from
Administration >> Layouts
orBrowse >> Space Admin >> Layouts
. - If you can't get to either of those pages, you can completely remove all decorators as follows:
- Back up your database using database-native tools.
- Shut Down Confluence
Save a copy of your customizations by saving the output of this query:
select * from decorator;
Delete your customizations:
delete from decorator;
- Start Confluence
- Try rebuilding the Confluence index from scratch.
- Reference CONF-15247 to get a better understanding of what is causing the crash. If you're using 3.1.2 (or onwards) version, update theAdvanced Macro to version 1.6.9. If you're using a older version, please upgrade to a later version of Confluence.
- Page titles may be null. See 'java.lang.RuntimeException - Error rendering template for decorator root' when Accessing a Page Due to Null Page Titles.
- Follow the instructions for Cannot edit page: Editing or Deleting a Page That Won't Render.
- Fix the encoding in Confluence server. It has to be
UTF-8.