Navigating to Certain Pages Triggers Stack Trace
Symptoms
Navigating to certain pages/spaces triggers an error page with a stack trace:
The following appears in the atlassian-confluence.log
:
2014-11-25 11:39:07,461 ERROR [http-bio-8556-exec-2] [ContainerBase.[Standalone].[localhost].[/confluence]] log Unhandled exception occurred whilst decorating page
-- url: /confluence/display/OS/Office+Space+Home | userName: admin | referer: http://localhost:8556/confluence/admin/cache/showStatistics.action
java.lang.RuntimeException: javax.servlet.ServletException: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getConfluenceResourceTags' in class com.atlassian.confluence.setup.velocity.VelocityFriendlyPageBuilderService threw exception java.lang.ClassCastException: java.util.HashMap cannot be cast to java.lang.Integer at /decorators/includes/header.vm[line 76, column 20]
at com.atlassian.confluence.util.profiling.ConfluenceSitemeshDecorator$1.doInTransaction(ConfluenceSitemeshDecorator.java:104)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:128)
at com.atlassian.confluence.util.profiling.ConfluenceSitemeshDecorator.render(ConfluenceSitemeshDecorator.java:90)
...
Caused by: javax.servlet.ServletException: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getConfluenceResourceTags' in class com.atlassian.confluence.setup.velocity.VelocityFriendlyPageBuilderService threw exception java.lang.ClassCastException: java.util.HashMap cannot be cast to java.lang.Integer at /decorators/includes/header.vm[line 76, column 20]
... 170 more
Caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getConfluenceResourceTags' in class com.atlassian.confluence.setup.velocity.VelocityFriendlyPageBuilderService threw exception java.lang.ClassCastException: java.util.HashMap cannot be cast to java.lang.Integer at /decorators/includes/header.vm[line 76, column 20]
... 175 more
Caused by: java.lang.ClassCastException: java.util.HashMap cannot be cast to java.lang.Integer
... 187 more
Diagnosis
Run the following query to see what's stored in the database for atlassian.confluence.css.resource.counter for the problematic space. The returned value should be something like <int>5<int>. If not then you're affected by this issue.
select * from BANDANA where BANDANACONTEXT = '<SPACEKEY>' and BANDANAKEY = 'atlassian.confluence.css.resource.counter';
Be sure to replace <SPACEKEY> with the key of the problematic space
Cause
The value for atlassian.confluence.css.resource.counter is of a type other than integer, which Confluence does not expect and cannot handle. This could have happened if you had a custom theme in place in a version of Confluence before 4.1 and then upgraded to 4.1+.
Resolution
Since the space will probably be inaccessible, you'll have to fix the faulty value with a database update.
Be sure to backup your database first!
To remove the faulty value:
- Run the following query to change the value to <int>1<int>, which is the default value for that property:
update BANDANA
set BANDANAVALUE = '<int>1</int>'
where BANDANAKEY = 'atlassian.confluence.css.resource.counter' and BANDANACONTEXT = '<SPACEKEY>';
- Flush the Confluence caches or restart Confluence in order to pick up the database update.