Custom Decorator Malfunctioning

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

Confluence is running and accessible, but some parts of the GUI are not accessible, or produce system errors.

You may see some ParseErrorExceptions in the atlassian-confluence.log file similar to the following:

 2013-08-07 15:41:09,214 ERROR [http-8090-6] [opensymphony.webwork.dispatcher.VelocityResult] doExecute Unable to render Velocity Template, '/spaces/permissions/viewspaceperms.vm'
 -- space: XXXXXX | url: /spaces/spacepermissions.action | userName: username | referer: BASE_URL/display/SPACEKEY/Home | action: spacepermissions
java.lang.RuntimeException: Error rendering template for decorator root
	at com.atlassian.confluence.setup.velocity.ApplyDecoratorDirective.render(ApplyDecoratorDirective.java:186)
	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)
	...snip...
Caused by: org.apache.velocity.exception.ParseErrorException: Encountered "#elseif" at @SPACEKEY/decorators/space.vmd[line 31, column 5]
Was expecting one of:
    <EOF> 
    "(" ...
    <RPAREN> ...
    <ESCAPE_DIRECTIVE> ...
    <SET_DIRECTIVE> ...
    "##" ...
    "\\\\" ...
    "\\" ...
    <TEXT> ...
    "*#" ...
    "*#" ...
    <STRING_LITERAL> ...
    <IF_DIRECTIVE> ...
    <STOP_DIRECTIVE> ...
    <INTEGER_LITERAL> ...
    <FLOATING_POINT_LITERAL> ...
    <WORD> ...
    <BRACKETED_WORD> ...
    <IDENTIFIER> ...
    <DOT> ...
    "{" ...
    "}" ...
    
	at org.apache.velocity.Template.process(Template.java:141)
	at com.atlassian.confluence.util.velocity.ConfigurableResourceManager.loadResource(ConfigurableResourceManager.java:364)
	at com.atlassian.confluence.util.velocity.ConfigurableResourceManager.getResource(ConfigurableResourceManager.java:305)
	at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1400)
	at org.apache.velocity.app.VelocityEngine.getTemplate(VelocityEngine.java:422)
	at com.atlassian.confluence.util.velocity.VelocityUtils.getTemplate(VelocityUtils.java:110)
	at com.atlassian.confluence.util.velocity.VelocityUtils.renderTemplateWithoutSwallowingErrors(VelocityUtils.java:94)
	at com.atlassian.confluence.util.velocity.VelocityUtils.getRenderedTemplateWithoutSwallowingErrors(VelocityUtils.java:73)
	at com.atlassian.confluence.setup.velocity.ApplyDecoratorDirective.render(ApplyDecoratorDirective.java:182)
	... 281 more

 

Cause

When Customizing Site and Space Layouts, it's possible to break certain GUI operations. This happens when the Velocity engine is unable to parse the custom decorator.

Resolution

You can use one of the following resolutions:

  1. Remove or edit the offending layout by going to "Layouts" in Confluence Admin.
  2. Alternatively, you can edit the decorator by hitting the URL directly. Use the following URL, replacing in the correct base URL and decorator name:

    Global
    http://<BaseURL>/admin/editdecorator.action?decoratorName=decorators/main.vmd
    Spaces
    http://<BaseURL>/admin/editdecorator.action?decoratorName=decorators/main.vmd&key=SPACEKEY
  3. If neither of the previous two solutions work, then you can remove the relevant row(s) from the decorator table directly, using SQL. Confluence must not be running whilst making any SQL changes:

    Please prepare a full backup of your database and <confluence-home> directory, prior to applying any queries

    -- Get a copy of the decorator in case you want to still modify it
    select body from decorator where decoratorname = 'decorators/main.vmd';
    
    
    -- Remove the decorator
    delete from decorator where decoratorname = 'decorators/main.vmd';
Last modified on Jul 29, 2016

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.