Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-13618

NullPointerException in Template Admin Section

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Duplicate
    • Affects Version/s: 8.2.1
    • Fix Version/s: None
    • Component/s: Actions
    • Labels:
    • Environment:
      The test environment is a fresh XE 8.2.1 running on a Wildfly 9.0.1 configured with datasource and PostgreSQL 9.4.
    • Difficulty:
      Unknown
    • Similar issues:

      Description

      On a fresh install of XE 8.2.1, when trying to access the "Templates" section, a NullPointerException is triggered.

      Application starts and runs without a problem, loads the distribution wizard and gets the default UI on a new instance up and running, including the Templates Application, that is installed as a dependency. However, any try to load the Templates section fires the following exception:

      Failed to execute the [velocity] macro. Cause: [null]. Click on this message for details.
      org.xwiki.rendering.macro.MacroExecutionException: Failed to evaluate Velocity Macro for content [## Create form, left column.
      (% class="col-xs-12 col-md-6" %)(((
      == {{translation key="admin.templates.createprovider"/}} ==
      
      {{html}}
        <form class="xform" action="$doc.getURL('create')" method="post">
      
          #template('locationPicker_macros.vm')
          #locationPicker({
            'id': 'target',
            'title': {
              'label': 'core.create.title',
              'hint': 'core.create.title.hint',
              'name': 'title',
              'placeholder': 'admin.templates.createprovider.defaultdocname'
            },
            'preview': {
              'label': 'core.create.locationPreview.label',
              'hint': 'core.create.locationPreview.hint'
            },
            'parent': {
              'label': 'core.create.spaceReference.label',
              'hint': 'core.create.spaceReference.hint',
              'name': 'spaceReference',
              'reference': $doc.documentReference.lastSpaceReference,
              'placeholder': 'core.create.spaceReference.placeholder'
            },
            'name': {
              'label': 'core.create.name.label',
              'hint': 'core.create.name.hint',
              'name': 'name',
              'value': '',
              'placeholder': 'admin.templates.createprovider.defaultdocname'
            }
          })
          #if ($isAdvancedUser || $isSuperAdmin)
            <dl>
              <dt>
                <label for="terminal">
                  <input type="checkbox" id="terminal" name="tocreate" value="terminal" checked="checked" />
                  $services.localization.render('core.create.terminal.label')
                </label>
              </dt>
              <dd>
                <span class="xHint">$services.localization.render('core.create.terminal.hint')</span>
              </dd>
            </dl>
          #else
            <input type="hidden" id="terminal" name="tocreate" value="terminal" />
          #end
          <div class="buttons">
            <input type="hidden" name="form_token" value="$!{services.csrf.getToken()}" />
            <input type="hidden" name="parent" value="XWiki.TemplateProviderClass"/>
            <input type="hidden" name="template" value="XWiki.TemplateProviderTemplate"/>
            <span class="buttonwrapper"><input id="createTemplateProvider" type="submit" value="$services.localization.render('admin.templates.createprovider.create')" class="button"/></span>
          </div>
        </form>
      {{/html}}
      )))
      
      ## Available providers list, right column.
      #set($availableProviders = $services.query.hql("
        , BaseObject obj
        WHERE
          doc.fullName=obj.name and obj.className='XWiki.TemplateProviderClass' and doc.fullName!='XWiki.TemplateProviderTemplate'
        ORDER BY
          doc.fullName").execute())
      #if($availableProviders.size() > 0)
        (% class="col-xs-12 col-md-6" %)(((
        == {{translation key="admin.templates.providerslist"/}} ==
      
          #foreach($providerFullname in $availableProviders)
            * [[$xwiki.getDocument($providerFullname).getTitle()>>$providerFullname]]
          #end
        )))
      #end
      ]
      	at org.xwiki.rendering.internal.macro.velocity.VelocityMacro.evaluateString(VelocityMacro.java:131)
      	at org.xwiki.rendering.internal.macro.velocity.VelocityMacro.evaluateString(VelocityMacro.java:50)
      	at org.xwiki.rendering.macro.script.AbstractScriptMacro.evaluateBlock(AbstractScriptMacro.java:286)
      	at org.xwiki.rendering.macro.script.AbstractScriptMacro.execute(AbstractScriptMacro.java:182)
      	at org.xwiki.rendering.macro.script.AbstractScriptMacro.execute(AbstractScriptMacro.java:58)
      	at org.xwiki.rendering.internal.transformation.macro.MacroTransformation.transform(MacroTransformation.java:272)
      	at org.xwiki.rendering.internal.transformation.DefaultRenderingContext.transformInContext(DefaultRenderingContext.java:183)
      	at org.xwiki.rendering.internal.transformation.DefaultTransformationManager.performTransformations(DefaultTransformationManager.java:95)
      	at org.xwiki.display.internal.DocumentContentDisplayer.display(DocumentContentDisplayer.java:263)
      	at org.xwiki.display.internal.DocumentContentDisplayer.display(DocumentContentDisplayer.java:133)
      	at org.xwiki.display.internal.DocumentContentDisplayer.display(DocumentContentDisplayer.java:58)
      	at org.xwiki.display.internal.DefaultDocumentDisplayer.display(DefaultDocumentDisplayer.java:96)
      	at org.xwiki.display.internal.DefaultDocumentDisplayer.display(DefaultDocumentDisplayer.java:39)
      	at org.xwiki.sheet.internal.SheetDocumentDisplayer.display(SheetDocumentDisplayer.java:239)
      	at org.xwiki.sheet.internal.SheetDocumentDisplayer.applySheet(SheetDocumentDisplayer.java:219)
      	at org.xwiki.sheet.internal.SheetDocumentDisplayer.maybeDisplayWithSheet(SheetDocumentDisplayer.java:174)
      	at org.xwiki.sheet.internal.SheetDocumentDisplayer.display(SheetDocumentDisplayer.java:111)
      	at org.xwiki.sheet.internal.SheetDocumentDisplayer.display(SheetDocumentDisplayer.java:52)
      	at org.xwiki.display.internal.ConfiguredDocumentDisplayer.display(ConfiguredDocumentDisplayer.java:68)
      	at org.xwiki.display.internal.ConfiguredDocumentDisplayer.display(ConfiguredDocumentDisplayer.java:42)
      	at com.xpn.xwiki.script.display.DisplayScriptService.document(DisplayScriptService.java:141)
      	at com.xpn.xwiki.script.display.DisplayScriptService.content(DisplayScriptService.java:204)
      	at com.xpn.xwiki.script.display.DisplayScriptService.content(DisplayScriptService.java:163)
      	at sun.reflect.GeneratedMethodAccessor811.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      	at java.lang.reflect.Method.invoke(Unknown Source)
      	at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:395)
      	at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:384)
      	at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:173)
      	at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:280)
      	at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:369)
      	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.ASTBlock.render(ASTBlock.java:72)
      	at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:342)
      	at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:106)
      	at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:342)
      	at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluateInternal(DefaultVelocityEngine.java:259)
      	at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:222)
      	at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:198)
      	at com.xpn.xwiki.internal.template.InternalTemplateManager.evaluateContent(InternalTemplateManager.java:713)
      	at com.xpn.xwiki.internal.template.InternalTemplateManager.render(InternalTemplateManager.java:621)
      	at com.xpn.xwiki.internal.template.InternalTemplateManager.renderFromSkin(InternalTemplateManager.java:599)
      	at com.xpn.xwiki.internal.template.InternalTemplateManager.renderFromSkin(InternalTemplateManager.java:570)
      	at com.xpn.xwiki.internal.template.InternalTemplateManager.render(InternalTemplateManager.java:556)
      	at com.xpn.xwiki.internal.template.DefaultTemplateManager.render(DefaultTemplateManager.java:65)
      	at com.xpn.xwiki.XWiki.evaluateTemplate(XWiki.java:2015)
      	at com.xpn.xwiki.web.Utils.parseTemplate(Utils.java:180)
      	at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:449)
      	at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:193)
      	at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425)
      	at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228)
      	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
      	at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
      	at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:86)
      	at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:130)
      	at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:115)
      	at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
      	at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132)
      	at org.xwiki.wysiwyg.server.filter.ConversionFilter.doFilter(ConversionFilter.java:127)
      	at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
      	at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132)
      	at org.xwiki.container.servlet.filters.internal.SetHTTPHeaderFilter.doFilter(SetHTTPHeaderFilter.java:63)
      	at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
      	at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132)
      	at org.xwiki.container.servlet.filters.internal.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:208)
      	at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
      	at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132)
      	at org.xwiki.container.servlet.filters.internal.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:111)
      	at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
      	at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132)
      	at org.xwiki.resource.servlet.RoutingFilter.doFilter(RoutingFilter.java:137)
      	at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
      	at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132)
      	at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:85)
      	at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
      	at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
      	at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
      	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      	at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
      	at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
      	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      	at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
      	at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
      	at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58)
      	at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:72)
      	at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
      	at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76)
      	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      	at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
      	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      	at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:282)
      	at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:261)
      	at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:80)
      	at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:172)
      	at io.undertow.server.Connectors.executeRootHandler(Connectors.java:199)
      	at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:774)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      	at java.lang.Thread.run(Unknown Source)
      Caused by: org.xwiki.velocity.XWikiVelocityException: Failed to evaluate content with id [xwiki:XWiki.AdminSheet]
      	at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:227)
      	at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:198)
      	at org.xwiki.rendering.internal.macro.velocity.VelocityMacro.evaluateString(VelocityMacro.java:124)
      	... 102 more
      Caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getParameter' in  class com.xpn.xwiki.web.XWikiServletRequest threw exception java.lang.NullPointerException at 276:xwiki:XWiki.AdminSheet[line 90, column 31]
      	at org.apache.velocity.runtime.parser.node.ASTMethod.handleInvocationException(ASTMethod.java:243)
      	at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:187)
      	at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:280)
      	at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:567)
      	at org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:71)
      	at org.apache.velocity.runtime.parser.node.ASTSetDirective.render(ASTSetDirective.java:142)
      	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
      	at org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:216)
      	at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:311)
      	at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:230)
      	at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:207)
      	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
      	at org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:216)
      	at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:311)
      	at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:230)
      	at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:207)
      	at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:342)
      	at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluateInternal(DefaultVelocityEngine.java:259)
      	at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:222)
      	... 104 more
      Caused by: java.lang.NullPointerException
      	at java.util.TreeMap.getEntry(Unknown Source)
      	at java.util.TreeMap.get(Unknown Source)
      	at io.undertow.servlet.spec.HttpServletRequestImpl.getParameter(HttpServletRequestImpl.java:624)
      	at javax.servlet.ServletRequestWrapper.getParameter(ServletRequestWrapper.java:194)
      	at org.xwiki.container.servlet.filters.internal.SavedRequestRestorerFilter$SavedRequestWrapper.getParameter(SavedRequestRestorerFilter.java:127)
      	at com.xpn.xwiki.web.XWikiServletRequest.getParameter(XWikiServletRequest.java:281)
      	at sun.reflect.GeneratedMethodAccessor317.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      	at java.lang.reflect.Method.invoke(Unknown Source)
      	at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:395)
      	at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:384)
      	at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:173)
      	... 121 more
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                tmortagne Thomas Mortagne
                Reporter:
                ramongb Ramon Brandão
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Date of First Response: