"500 - Internal server error" while trying to view an attachment

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. 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

Summary

Problem

Complications in previewing attachments in Confluence such as PDF and PowerPoint files with the error:

1 2 3 4 5 6 7 8 9 10 pageId : 42863378 fileName : Testpowerpointfile.pptx caused by: java.lang.RuntimeException: Error rendering template for decorator root at com.atlassian.confluence.setup.velocity.ApplyDecoratorDirective.render(ApplyDecoratorDirective.java:191) caused by: java.lang.RuntimeException: Error rendering template for decorator page at com.atlassian.confluence.setup.velocity.ApplyDecoratorDirective.render(ApplyDecoratorDirective.java:191) caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'replace' in class java.lang.String threw exception java.lang.NullPointerException at /originaltheme/templates/decorators/includes/velocity-macros.vm[line 229, column 47] at org.apache.velocity.runtime.parser.node.ASTMethod.handleInvocationException(ASTMethod.java:337) caused by: java.lang.NullPointerException at java.lang.String.replace(Unknown Source)

The following appears in the atlassian-confluence.log

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2015-07-21 11:16:39,747 ERROR [ajp-bio-127.0.0.1-7990-exec-48] [atlassian.confluence.servlet.ConfluenceServletDispatcher] sendError Could not execute action -- url: /pages/worddav/preview.action | userName: kh280 | referer: https://ruterwiki.ruter.no/pages/viewpageattachments.action?pageId=44566815 java.lang.RuntimeException: Error rendering template for decorator root at com.atlassian.confluence.setup.velocity.ApplyDecoratorDirective.render(ApplyDecoratorDirective.java:191) 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) at org.apache.velocity.Template.merge(Template.java:235) at com.opensymphony.webwork.dispatcher.VelocityResult.doExecute(VelocityResult.java:91) at com.atlassian.xwork.results.ProfiledVelocityResult.doExecute(ProfiledVelocityResult.java:21) at com.atlassian.confluence.setup.webwork.EncodingVelocityResult.doExecute(EncodingVelocityResult.java:48) Caused by: java.lang.RuntimeException: Error rendering template for decorator page at com.atlassian.confluence.setup.velocity.ApplyDecoratorDirective.render(ApplyDecoratorDirective.java:191) at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175) Caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'replace' in class java.lang.String threw exception java.lang.NullPointerException at /originaltheme/templates/decorators/includes/velocity-macros.vm[line 229, column 47] at org.apache.velocity.runtime.parser.node.ASTMethod.handleInvocationException(ASTMethod.java:337) at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:284) Caused by: java.lang.NullPointerException at java.lang.String.replace(Unknown Source) at sun.reflect.GeneratedMethodAccessor6307.invoke(Unknown Source)

Diagnosis

Environment

  • The line from the logs:

    1 /originaltheme/templates/decorators/includes/velocity-macros.vm

    Indicates that you have RefinedWiki Original Theme installed in your instance

Cause

This is a know bug from RefinedWiki Original Theme:

Solution

Resolution

Make sure you have the plugin up to date. see Managing Add-ons or Plugins to manage all your third party plugins.

Updated on April 24, 2025

Still need help?

The Atlassian Community is here for you.