'java.lang.RuntimeException - Error rendering template for decorator root' when Accessing a Page Due to Null Page Titles
Symptoms
The primary article here is 'java.lang.RuntimeException - Error rendering template for decorator root' when Accessing a Page Due to Null Page Titles.
A stack trace error appears when visiting a page. Other pages in the space do not exhibit this error.
The following appears in the atlassian-confluence.log
:
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)
...
... 185 more
Caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getPermittedChildren' in class com.atlassian.confluence.pages.actions.ViewPageAction threw exception java.lang.NullPointerException at template/includes/macros.vm[line 1131, column 25]
at org.apache.velocity.runtime.parser.node.ASTMethod.handleInvocationException(ASTMethod.java:337)
at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:284)
... 200 more
Caused by: java.lang.NullPointerException
at com.atlassian.confluence.pages.NaturalStringComparator.compareNatural(NaturalStringComparator.java:75)
at com.atlassian.confluence.pages.NaturalStringComparator.compareNatural(NaturalStringComparator.java:57)
at com.atlassian.confluence.pages.NaturalStringComparator.compare(NaturalStringComparator.java:42)
at com.atlassian.confluence.pages.Page$ChildPositionComparator.compare(Page.java:313)
at com.atlassian.confluence.pages.Page$ChildPositionComparator.compare(Page.java:282)
at java.util.Arrays.mergeSort(Arrays.java:1270)
at java.util.Arrays.mergeSort(Arrays.java:1282)
at java.util.Arrays.sort(Arrays.java:1210)
at java.util.Collections.sort(Collections.java:159)
at com.atlassian.confluence.pages.Page.getSortedChildren(Page.java:124)
at com.atlassian.confluence.core.DefaultContentPermissionManager.getPermittedChildren(DefaultContentPermissionManager.java:275)
at sun.reflect.GeneratedMethodAccessor600.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy13.getPermittedChildren(Unknown Source)
at com.atlassian.confluence.pages.actions.AbstractPageAction.getPermittedChildren(AbstractPageAction.java:230)
at sun.reflect.GeneratedMethodAccessor540.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:389)
at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:378)
at com.atlassian.confluence.velocity.introspection.UnboxingMethod.invoke(UnboxingMethod.java:31)
at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:270)
... 219 more
Cause
There are some child pages of the affected page without any title (i.e. "undefined'). Upon searching in the database one will find that they have null values. These pages do not have any title defined in Confluence as they have a null value in the TITLE
field of the CONTENT
table.
When Confluence renders a page, it also displays child pages at the bottom of the page. Confluence will sort the child pages based on its set (Child) position, and will at times fall back to comparing the titles in order to determine the permission search order.
If the page title is undefined, Confluence will throw a Nullpointerexception error, as shown in the last "Caused by" section in the log.
Resolution
Add titles to pages that have null titles by updating the database. For example, in MySQL you would execute the following:
Make sure to backup your database before making any modifications
update CONTENT set TITLE = 'no title' where TITLE is null AND CONTENTTYPE = 'PAGE';
'Flush all' in the Cache Statistics screen.