Details
-
Bug
-
Resolution: Fixed
-
High
-
3.4, 3.4.1
-
None
Description
Steps to reproduce:
- Set the Global theme to a plugin, such as the Documentation Theme
- Disable that plugin
- Logout
Instead of the login screen you'll get this:
Error occurred during template rendering: Invocation of method 'getThemeJsResources' in class $Proxy51 threw exception java.lang.NullPointerException at template/includes/macros.vm[line 629, column 26]. Contact your administrator for assistance.
And the logs will have lots of these:
-- url: /login.action | userName: anonymous org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getThemeJsResources' in class $Proxy51 threw exception java.lang.NullPointerException at template/includes/macros.vm[line 629, column 26] at org.apache.velocity.runtime.parser.node.ASTMethod.handleInvocationException(ASTMethod.java:337) at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:284) at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:252) at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:332) at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72) at org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:212) at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:247) at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175) at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72) at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:87) at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336) at org.apache.velocity.runtime.directive.Parse.render(Parse.java:260) at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175) at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72) at org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:212) at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:247) at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175) at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72) at org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:212) at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:247) 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.atlassian.confluence.util.velocity.VelocityUtils.renderTemplateWithoutSwallowingErrors(VelocityUtils.java:62) at com.atlassian.confluence.util.velocity.VelocityUtils.renderTemplateWithoutSwallowingErrors(VelocityUtils.java:68) at com.atlassian.confluence.util.profiling.ConfluenceSitemeshDecorator$StreamingResponseWritingStrategy.renderToResponse(ConfluenceSitemeshDecorator.java:160) at com.atlassian.confluence.util.profiling.ConfluenceSitemeshDecorator.applyDecoratorUsingVelocity(ConfluenceSitemeshDecorator.java:111) at com.atlassian.confluence.util.profiling.ConfluenceSitemeshDecorator.applyDecorator(ConfluenceSitemeshDecorator.java:54) at com.atlassian.confluence.util.profiling.ProfilingPageFilter.applyDecorator(ProfilingPageFilter.java:65) at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:61)
Note that some theme plugins have been known to occasionally have some modules missing CONF-19144.
Workaround
Since the error comes from a decorator you can work around it be passing the decorator=none param, like so:
- Go to http://<baseurl>/login.action?decorator=none and login
- Go to http://<baseurl>/admin/viewplugins.action?decorator=none
- Click on the problematic plugin, then append &decorator=none to the URL
- Click Enable Plugin
If you have authenticated admin sessions turned on it complicates matters but the same tactic works.
If the theme is broken and can't be enabled then instead go to
- http://localhost:8341/admin/choosetheme.action?decorator=none and change the enabled theme.
Other Workaround
If none of the above helps and you have access to the database then:
- Stop Confluence
- Run the following SQL query
select * from bandana where bandana.bandanacontext = '_GLOBAL' and bandana.bandanakey = 'atlassian.confluence.theme.settings'
- Confirm it returned only 1 row. Then delete that row by running
delete from bandana where bandana.bandanacontext = '_GLOBAL' and bandana.bandanakey = 'atlassian.confluence.theme.settings'
- Commit
- Restart Confluence
Suggested fixes?
Harden the login and admin screens against this theme breakage.
Provide the means to clear the global theme at start-up.