Legacy Knowledge Base
Published Jul. 2, 2025

Unable to show journal articles

Written By

Sergio Alonso

How To articles are not official guidelines or officially supporteddocumentation. They are community-contributed content and may not alwaysreflect the latest updates to Liferay DXP. We welcome your feedback toimprove How to articles!

While we make every effort to ensure this Knowledge Base is accurate, itmay not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with anyfeedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack"publication program, made available for informational purposes. Articlesin this program were published without a requirement for independentediting or verification and are provided "as is" withoutguarantee.

Before using any information from this article, independently verify itssuitability for your situation and project.

Issue

  • We have some troubles when trying to show web contents.
    • Scenario 1: Trying to show a web content in search results page. Some of the web contents in the search result show the error message "An error occurred while processing the template. The following has evaluated to null or missing: ==> webContentData.title".
    • Scenario 2: Trying to select a web content for display in a Web Content Display widget. The description of the web content is replaced with the error message "An error occurred while processing the template. The following has evaluated to null or missing: ==> webContentData.title"
  • Both scenarios have in common following stack trace:
2022-05-13 13:30:18.653 ERROR [http-nio-8080-exec-7][runtime:59] Error executing FreeMarker template 
FreeMarker template error:
The following has evaluated to null or missing:
==> webContentData.title [in template "20101#20128#null" at line 6, column 11]

----
Tip: It's the step after the last dot that caused this error, not those before it.
----
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: ${webContentData.title} [in template "20101#20128#null" at line 6, column 9]
----

Java stack trace (for programmers):
----
freemarker.core.InvalidReferenceException: [... Exception message was already printed; see it above ...]
at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:134)
at freemarker.core.EvalUtil.coerceModelToTextualCommon(EvalUtil.java:479)
at freemarker.core.EvalUtil.coerceModelToStringOrMarkup(EvalUtil.java:401)
at freemarker.core.EvalUtil.coerceModelToStringOrMarkup(EvalUtil.java:370)
at freemarker.core.DollarVariable.calculateInterpolatedStringOrMarkup(DollarVariable.java:100)
at freemarker.core.DollarVariable.accept(DollarVariable.java:63)
at freemarker.core.Environment.visit(Environment.java:331)
at freemarker.core.Environment.visit(Environment.java:337)
at freemarker.core.Environment.process(Environment.java:310)
at freemarker.template.Template.process(Template.java:383)
at com.liferay.portal.template.freemarker.internal.FreeMarkerTemplate.processTemplate(FreeMarkerTemplate.java:154)
at com.liferay.portal.template.BaseTemplate.processTemplate(BaseTemplate.java:163)
at com.liferay.journal.internal.transformer.JournalTransformer.doTransform(JournalTransformer.java:367)
at com.liferay.journal.internal.transformer.JournalTransformer.transform(JournalTransformer.java:103)
at com.liferay.journal.internal.util.JournalUtil.transform(JournalUtil.java:424)
at com.liferay.journal.service.impl.JournalArticleLocalServiceImpl.getArticleDisplay(JournalArticleLocalServiceImpl.java:7987)
at com.liferay.journal.service.impl.JournalArticleLocalServiceImpl.getArticleDisplay(JournalArticleLocalServiceImpl.java:2536)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.liferay.portal.spring.aop.AopMethodInvocationImpl.proceed(AopMethodInvocationImpl.java:50)
at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:69)
at com.liferay.portal.spring.aop.AopMethodInvocationImpl.proceed(AopMethodInvocationImpl.java:57)
at com.liferay.portal.spring.aop.AopInvocationHandler.invoke(AopInvocationHandler.java:49)
at com.sun.proxy.$Proxy875.getArticleDisplay(Unknown Source)
at com.liferay.journal.service.JournalArticleLocalServiceUtil.getArticleDisplay(JournalArticleLocalServiceUtil.java:1448)
at com.liferay.journal.web.internal.asset.model.JournalArticleAssetRenderer.getSummary(JournalArticleAssetRenderer.java:244)
at org.apache.jsp.view_jsp._jspService(view_jsp.java:812)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)
.
.
.

Environment

  • Liferay DXP 7.2
  • Liferay DXP 7.3

Resolution

  • The compiling error of the Freemarker template has as root cause that a web content is based on an structure without any associated template. Furthermore,  the structure has a Web Content field (type«ddm-journal-article») in his definition and this field has not any value assigned.
  • So, a default template is used by Liferay DXP (template«journal-article.ftl») because of the existence of this field.
  • This particular template expects some specific values. One of them is the Web Content's Title. As there is not any web content assigned, this value (Title) is null.
  • Thus, compiling process of the template throws the error:
FreeMarker template error: 
The following has evaluated to null or missing:
==> webContentData.title [in template "20101#20128#null" at line 6, column 11]
  • The solution is to assign a value to the Web Content field (type«ddm-journal-article») in the structure.

 

 

Did this article resolve your issue ?

Legacy Knowledge Base