"java.lang.ClassCastException: com.atlassian.confluence.pages.Page cannot be cast to com.atlassian.confluence.pages.BlogPost" Error While Rendering Blog Post Macro

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

Symptoms

Blog post Macro Fails to render, and the following appears in the atlassian-confluence.log:

1 2 3 4 Caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getPostingYear' in class com.atlassian.confluence.pages.BlogPost$$EnhancerByCGLIB$$118c9662 threw exception java.lang.ClassCastException: com.atlassian.confluence.pages.Page cannot be cast to com.atlassian.confluence.pages.BlogPost at template/includes/macros.vm[line 721, column 72] at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:223) at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:262) at

Diagnosis

This issue can be reproduced each time a blog post is renamed, as per: CONFSERVER-16694 - After renaming a BlogPost, pageManager.getById() return a Page, not a BlogPost

Cause

Third party plugins, such as the PageTypes plugin by Scandio (de.scandio.confluence.plugins.pagetypes)

Solution

Resolution

  • Enable Safe Mode via Confluence Admin >> Manage Add-Ons

  • Alternatively, you can look for the PageTypes plugin by Scandio and disable that

Updated on April 11, 2025

Still need help?

The Atlassian Community is here for you.