Uploaded image for project: 'Confluence Server'
  1. Confluence Server
  2. CONFSERVER-21207

Disabling the global theme prevents users from logging in due to getThemeJsResources problem

    XMLWordPrintable

    Details

      Description

      Steps to reproduce:

      1. Set the Global theme to a plugin, such as the Documentation Theme
      2. Disable that plugin
      3. 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:

      1. Go to http://<baseurl>/login.action?decorator=none and login
      2. Go to http://<baseurl>/admin/viewplugins.action?decorator=none
      3. Click on the problematic plugin, then append &decorator=none to the URL
      4. 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

      1. 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:

      1. Stop Confluence
      2. Run the following SQL query
        select * from bandana where bandana.bandanacontext = '_GLOBAL' and bandana.bandanakey = 'atlassian.confluence.theme.settings'
      3. 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'
      4. Commit
      5. 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.

        Attachments

          Activity

            People

            • Assignee:
              don.willis@atlassian.com Don Willis
              Reporter:
              don.willis@atlassian.com Don Willis
              Participants:
              Last Touched By:
              Katherine Yabut
              Reviewers:
              Agnes Ro, Matthew Erickson, Stefan Saasen
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Last commented:
                7 years, 32 weeks, 5 days ago