Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-34662

Web Content - Previewing a published Web Content which was created based on a Structure and Template throws console error

    Details

      Description

      Previewing WCs created with a template using the FreeMarker scripting language has different problems than previewing one that used Velocity

      Steps to reproduce:

      1. Go to > Control Panel > Web Content
      2. Add a Structure with a Text and Text Box field
      3. Add a Template based on that structure (using the default FreeMarker (.ftl) scripting language), by clicking on the Text and Text Box words in the left panel (see FreeMarker... screenshot) > Save > Close iframe
      4. Refresh Web Content Front Page
      5. Publish a WC based on the structure/template combo, putting some characters in each field (e.g. '123', '456' & '789')
      6. After publishing, click into WC and click Preview button

      Expected result:
      New tab will open up with the 123, 456, 789 displaying.

      Actual result:
      Console error is thrown with a UI error (see Preview...Freemarker screenshot).

      NOTE: Publishing with Velocity doesn't throw console errors upon previewing the WC, but the preview just shows the template script.

      23:15:58,468 ERROR [http-bio-8080-exec-10][runtime:96] Template processing error: "Expression text1812 is undefined on line 1, column 3 in 1#10147#10424."
      
      Expression text1812 is undefined on line 1, column 3 in 1#10147#10424.
      The problematic instruction:
      ----------
      ==> ${text1812.getData()} [on line 1, column 1 in 1#10147#10424]
      ----------
      
      Java backtrace for programmers:
      ----------
      freemarker.core.InvalidReferenceException: Expression text1812 is undefined on line 1, column 3 in 1#10147#10424.
              at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:125)
              at freemarker.core.TemplateObject.invalidTypeException(TemplateObject.java:135)
              at freemarker.core.Dot._getAsTemplateModel(Dot.java:78)
              at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
              at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:86)
              at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
              at freemarker.core.Expression.getStringValue(Expression.java:93)
              at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
              at freemarker.core.Environment.visit(Environment.java:221)
              at freemarker.core.MixedContent.accept(MixedContent.java:92)
              at freemarker.core.Environment.visit(Environment.java:221)
              at freemarker.core.Environment.process(Environment.java:199)
              at freemarker.template.Template.process(Template.java:237)
              at com.liferay.portal.freemarker.FreeMarkerTemplate.processTemplate(FreeMarkerTemplate.java:140)
              at com.liferay.portal.template.AbstractTemplate.doProcessTemplate(AbstractTemplate.java:100)
              at com.liferay.portal.template.AbstractProcessingTemplate.processTemplate(AbstractProcessingTemplate.java:42)
              at com.liferay.portal.template.RestrictedTemplate.processTemplate(RestrictedTemplate.java:51)
              at com.liferay.portal.templateparser.Transformer.mergeTemplate(Transformer.java:629)
              at com.liferay.portal.templateparser.Transformer.transform(Transformer.java:329)
              at com.liferay.portlet.journal.util.JournalUtil.transform(JournalUtil.java:1240)
              at com.liferay.portlet.journal.service.impl.JournalArticleLocalServiceImpl.getArticleDisplay(JournalArticleLocalServiceImpl.java:1748)
              at com.liferay.portlet.journal.service.impl.JournalArticleLocalServiceImpl.getArticleContent(JournalArticleLocalServiceImpl.java:1432)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:601)
              at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:112)
              at com.liferay.portal.spring.transaction.DefaultTransactionExecutor.execute(DefaultTransactionExecutor.java:61)
              at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:51)
              at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:108)
              at com.liferay.portal.spring.aop.ServiceBeanAopProxy.invoke(ServiceBeanAopProxy.java:166)
              at com.liferay.portal.security.pacl.PACLInvocationHandler.doInvoke(PACLInvocationHandler.java:61)
              at com.liferay.portal.security.pacl.PACLInvocationHandler.invoke(PACLInvocationHandler.java:50)
              at com.sun.proxy.$Proxy458.getArticleContent(Unknown Source)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:601)
              at com.liferay.portal.security.pacl.PortalSecurityManagerImpl$DoBeanLocatorImplPACL$1.invoke(PortalSecurityManagerImpl.java:471)
              at com.liferay.portal.security.pacl.PACLInvocationHandler.doInvoke(PACLInvocationHandler.java:61)
              at com.liferay.portal.security.pacl.PACLInvocationHandler.invoke(PACLInvocationHandler.java:50)
              at com.sun.proxy.$Proxy635.getArticleContent(Unknown Source)
              at com.liferay.portlet.journal.service.JournalArticleLocalServiceUtil.getArticleContent(JournalArticleLocalServiceUtil.java:956)
              at com.liferay.portlet.journal.action.ViewArticleContentAction.execute(ViewArticleContentAction.java:144)
              at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
              at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
              at com.liferay.portal.struts.PortalRequestProcessor.process(PortalRequestProcessor.java:174)
              at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
              at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
              at com.liferay.portal.servlet.MainServlet.callParentService(MainServlet.java:545)
              at com.liferay.portal.servlet.MainServlet.service(MainServlet.java:522)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
              at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
              at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
              at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
              at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
              at com.liferay.portal.servlet.filters.strip.StripFilter.processFilter(StripFilter.java:358)
              at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
              at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
              at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
              at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
              at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
              at com.liferay.portal.servlet.filters.gzip.GZipFilter.processFilter(GZipFilter.java:123)
              at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
              at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
              at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
              at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
              at com.liferay.portal.servlet.filters.secure.SecureFilter.processFilter(SecureFilter.java:293)
              at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
              at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
              at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
              at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
              at com.liferay.portal.servlet.filters.jsoncontenttype.JSONContentTypeFilter.processFilter(JSONContentTypeFilter.java:42)
              at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
              at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
              at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
              at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
              at com.liferay.portal.servlet.filters.sso.ntlm.NtlmPostFilter.processFilter(NtlmPostFilter.java:83)
              at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
              at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
              at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
              at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
              at com.liferay.portal.sharepoint.SharepointFilter.processFilter(SharepointFilter.java:88)
              at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
              at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
              at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
              at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
              at com.liferay.portal.servlet.filters.virtualhost.VirtualHostFilter.processFilter(VirtualHostFilter.java:193)
              at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
              at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
              at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
              at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:187)
              at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:95)
              at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
              at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
              at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
              at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
              at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:738)
              at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
              at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
              at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:167)
              at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:95)
              at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
              at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:167)
              at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:95)
              at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
              at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:187)
              at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:95)
              at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:79)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
              at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
              at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
              at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
              at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
              at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
              at java.lang.Thread.run(Thread.java:722)
      

        Attachments

        1. FreemarkerTemplateCreation.PNG
          44 kB
          Brian Wulbern
        2. PreviewConsoleError.txt
          13 kB
          Brian Wulbern
        3. PreviewPublishedWithFreemarker.PNG
          7 kB
          Brian Wulbern

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  7 years, 12 weeks, 3 days ago

                  Packages

                  Version Package
                  6.2.0 CE B1