Uploaded image for project: 'PUBLIC - Liferay Commerce'
  1. PUBLIC - Liferay Commerce
  2. COMMERCE-5481

Freemarker template errors are thrown and the portal is unusable after changing the theme to Minium or Speedwell

    Details

      Description

      Context
      Liferay 7.3 comes pre-bundled with Commerce.

      Currently, the Minium theme and Speedwell theme are made available to be used, even if Commerce modules are not activated.

      Issue
      This is an issue, since both themes have undeclared dependencies on commerce modules, such as:

      • Minium: CommerceThemeMiniumTemplateContextContributor
      • Speedwell: CommerceWishListTemplateContextContributor

      This results in Freemarker errors, which make the portal unusable, when the themes are used.

      Steps to Reproduce - Minium Theme

      1. Start clean 7.3 GA1 bundle
      2. Navigate to Site Control Panel
        1. Site Builder -> Pages -> Public Pages -> Click gear icon
      3. Click Change Current Theme
      4. Select Minium and then save
      5. Click Home to go back to the home page

      Expected Results:
      One is taken back to the home page without issue

      Actual Results:
      Errors are thrown and Liferay immediately stops working (See below for sample error)

      To reproduce with Speedwell theme, simply select Speedwell theme instead of Minium theme.


      Sample Error (Condensed)

      HTTP Status 500 - Internal Server Error
      Type Exception Report
      
      Message Unable to process template minium-theme_SERVLET_CONTEXT_/templates/portal_normal.ftl
      
      Description The server encountered an unexpected condition that prevented it from fulfilling the request.
      
      Exception
      
      com.liferay.portal.kernel.template.TemplateException: Unable to process template minium-theme_SERVLET_CONTEXT_/templates/portal_normal.ftl
          com.liferay.portal.template.BaseTemplate.processTemplate(BaseTemplate.java:140)
          com.liferay.taglib.util.ThemeUtil.doIncludeFTL(ThemeUtil.java:224)
          com.liferay.taglib.util.ThemeUtil.include(ThemeUtil.java:112)
          com.liferay.taglib.util.ThemeUtil.include(ThemeUtil.java:76)
          com.liferay.taglib.theme.IncludeTag.doEndTag(IncludeTag.java:37)
          org.apache.jsp.html.common.themes.portal_jsp._jspx_meth_liferay_002dtheme_005finclude_005f1(portal_jsp.java:717)
          org.apache.jsp.html.common.themes.portal_jsp._jspService(portal_jsp.java:647)
          org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:71)
          javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
          com.liferay.portal.servlet.DirectRequestDispatcher.forward(DirectRequestDispatcher.java:49)
          com.liferay.portal.servlet.DirectRequestDispatcherFactoryImpl$IndirectRequestDispatcher.forward(DirectRequestDispatcherFactoryImpl.java:172)
          com.liferay.portal.servlet.ClassLoaderRequestDispatcherWrapper.doDispatch(ClassLoaderRequestDispatcherWrapper.java:82)
          com.liferay.portal.servlet.ClassLoaderRequestDispatcherWrapper.forward(ClassLoaderRequestDispatcherWrapper.java:45)
          com.liferay.portal.struts.StrutsUtil.forward(StrutsUtil.java:64)
          com.liferay.portal.struts.PortalRequestProcessor._internalModuleRelativeForward(PortalRequestProcessor.java:357)
          com.liferay.portal.struts.PortalRequestProcessor._process(PortalRequestProcessor.java:412)
          com.liferay.portal.struts.PortalRequestProcessor.process(PortalRequestProcessor.java:154)
          com.liferay.portal.internal.servlet.MainServlet.doGet(MainServlet.java:204)
          javax.servlet.http.HttpServlet.service(HttpServlet.java:626)
          com.liferay.portal.internal.servlet.MainServlet.service(MainServlet.java:620)
          ...
      Root Cause
      
      freemarker.core.InvalidReferenceException: The following has evaluated to null or missing:
      ==> commerceThemeMiniumHttpHelper  [in template "minium-theme_SERVLET_CONTEXT_/templates/init_custom.ftl" at line 11, column 29]
      
      ----
      Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
      ----
      
      ----
      FTL stack trace ("~" means nesting-related):
          - Failed at: userManagementUrl = commerceThemeMini...  [in template "minium-theme_SERVLET_CONTEXT_/templates/init_custom.ftl" at line 11, column 9]
          - Reached through: #include "${full_templates_path}/init...  [in template "minium-theme_SERVLET_CONTEXT_/templates/init.ftl" at line 386, column 1]
          - Reached through: #include init  [in template "minium-theme_SERVLET_CONTEXT_/templates/portal_normal.ftl" at line 2, column 1]
      ----
          freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:134)
          freemarker.core.UnexpectedTypeException.newDescriptionBuilder(UnexpectedTypeException.java:85)
          freemarker.core.UnexpectedTypeException.<init>(UnexpectedTypeException.java:48)
          freemarker.core.NonHashException.<init>(NonHashException.java:49)
          freemarker.core.Dot._eval(Dot.java:48)
          freemarker.core.Expression.eval(Expression.java:101)
          freemarker.core.MethodCall._eval(MethodCall.java:55)
          freemarker.core.Expression.eval(Expression.java:101)
          freemarker.core.Assignment.accept(Assignment.java:134)
          freemarker.core.Environment.visit(Environment.java:331)
          freemarker.core.Environment.visit(Environment.java:337)
          freemarker.core.Environment.visit(Environment.java:337)
          freemarker.core.Environment.include(Environment.java:2694)
          freemarker.core.Include.accept(Include.java:171)
          freemarker.core.Environment.visit(Environment.java:331)
          freemarker.core.Environment.visit(Environment.java:337)
          freemarker.core.Environment.include(Environment.java:2694)
          freemarker.core.Include.accept(Include.java:171)
          freemarker.core.Environment.visit(Environment.java:331)
          freemarker.core.Environment.visit(Environment.java:337)
          freemarker.core.Environment.process(Environment.java:310)
          freemarker.template.Template.process(Template.java:383)
          com.liferay.portal.template.freemarker.internal.FreeMarkerTemplate.processTemplate(FreeMarkerTemplate.java:154)
          com.liferay.portal.template.BaseTemplate.processTemplate(BaseTemplate.java:135)
          com.liferay.taglib.util.ThemeUtil.doIncludeFTL(ThemeUtil.java:224)
          com.liferay.taglib.util.ThemeUtil.include(ThemeUtil.java:112)
          com.liferay.taglib.util.ThemeUtil.include(ThemeUtil.java:76)
          com.liferay.taglib.theme.IncludeTag.doEndTag(IncludeTag.java:37)
          org.apache.jsp.html.common.themes.portal_jsp._jspx_meth_liferay_002dtheme_005finclude_005f1(portal_jsp.java:717)
          org.apache.jsp.html.common.themes.portal_jsp._jspService(portal_jsp.java:647)
          org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:71)
          javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
          com.liferay.portal.servlet.DirectRequestDispatcher.forward(DirectRequestDispatcher.java:49)
          com.liferay.portal.servlet.DirectRequestDispatcherFactoryImpl$IndirectRequestDispatcher.forward(DirectRequestDispatcherFactoryImpl.java:172)
          com.liferay.portal.servlet.ClassLoaderRequestDispatcherWrapper.doDispatch(ClassLoaderRequestDispatcherWrapper.java:82)
          com.liferay.portal.servlet.ClassLoaderRequestDispatcherWrapper.forward(ClassLoaderRequestDispatcherWrapper.java:45)
          com.liferay.portal.struts.StrutsUtil.forward(StrutsUtil.java:64)
          com.liferay.portal.struts.PortalRequestProcessor._internalModuleRelativeForward(PortalRequestProcessor.java:357)
          com.liferay.portal.struts.PortalRequestProcessor._process(PortalRequestProcessor.java:412)
          com.liferay.portal.struts.PortalRequestProcessor.process(PortalRequestProcessor.java:154)
          com.liferay.portal.internal.servlet.MainServlet.doGet(MainServlet.java:204)
          javax.servlet.http.HttpServlet.service(HttpServlet.java:626)
          com.liferay.portal.internal.servlet.MainServlet.service(MainServlet.java:620)
          ...
      Note The full stack trace of the root cause is available in the server logs.
      
      Apache Tomcat/9.0.37
       

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              lorenzo.lapescara Lorenzo La Pescara
              Reporter:
              eric.yan Eric Yan
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Packages

                  Version Package
                  7.4 CE GA1