Unable to load macro browser due to ClassCastException

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

Symptoms

When trying to add a macro in Confluence Editor, instead of showing a macro browser, a pop up box appears:

There has been an error loading the macro browser. Please try again or see your system administrator.

The following appears in the atlassian-confluence.log:

1 2 3 4 5 6 7 8 9 10 11 12 2012-08-10 15:03:21,194 ERROR [http-8080-7] [atlassian.confluence.servlet.ConfluenceServletDispatcher] sendError Could not execute action -- url: /confluence/plugins/macrobrowser/browse-macros.action | userName: eprout | referer: http:/<confluence-url>/pages/editpage.action?pageId=<pageID> java.lang.ClassCastException: java.lang.String cannot be cast to com.atlassian.confluence.renderer.UserMacroConfig at com.atlassian.confluence.macro.browser.UserMacroMetadataProvider.extractMetadata(UserMacroMetadataProvider.java:27) at com.atlassian.confluence.macro.browser.UserMacroMetadataProvider.getData(UserMacroMetadataProvider.java:20) at com.atlassian.confluence.macro.browser.DefaultMacroBrowserManager.buildMacroMetadata(DefaultMacroBrowserManager.java:59) at com.atlassian.confluence.macro.browser.DefaultMacroBrowserManager.getMacroMetadata(DefaultMacroBrowserManager.java:49) at com.atlassian.confluence.macro.browser.actions.BrowseMacrosAction.execute(BrowseMacrosAction.java:22) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:168) at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35) at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:165) .....

The error above is thrown when Confluence is trying to access the following URL in order to load the macro browser:

http://<confluence-url>/plugins/macrobrowser/browse-macros.action

The following appears in the browser JS console:

Failed to load resource: the server responded with a status of 500 (Internal Server Error) http://<confluence-url>/plugins/macrobrowser/browse-macros.action

Cause

There are some data with incorrect format (i.e. string) saved into User Macro field in the BANDANA table. To verify, try to execute the following SQL query:

1 SELECT * FROM BANDANA WHERE BANDANAKEY='atlassian.confluence.user.macros'

The BANDANAVALUE row needs to have an XML format (i.e. <map/> for empty user macros or <map>.....</map> for one or more user macros). If the value is of <string>...</string> format, please refer to the resolution to fix it.

Resolution

  1. Backup your Confluence database

  2. Run the following SQL query to remove all of the created user macros

    1 UPDATE BANDANA SET BANDANAVALUE='<map/>' WHERE BANDANAKEY='atlassian.confluence.user.macros';
  3. Restart Confluence

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.