Legacy Knowledge Base
Published Jun. 30, 2025

Freemarker Error in Notification Template

Written By

Jamilly Macedo

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

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

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

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

Issue

  • Creating a new custom object with a text field and an associated email notification that uses a FreeMarker template can result in an error that prevents the notification from being sent.

  • The following error is reported in logs:

Caused by: com.liferay.portal.kernel.log.LogSanitizerException: freemarker.core.InvalidReferenceException: The following has evaluated to null or missing:_==> titulo [in template "com.liferay.notification.model.NotificationTemplate#63272" at line 1, column 3]__----_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: ${titulo.getData()} [in template "com.liferay.notification.model.NotificationTemplate#63272" at line 1, column 1]_---- [Sanitized]
at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:134) ~[?:?]
at freemarker.core.UnexpectedTypeException.newDescriptionBuilder(UnexpectedTypeException.java:85) ~[?:?]
at freemarker.core.UnexpectedTypeException.<init>(UnexpectedTypeException.java:48) ~[?:?]
at freemarker.core.NonHashException.<init>(NonHashException.java:49) ~[?:?]
at freemarker.core.Dot._eval(Dot.java:48) ~[?:?]
at freemarker.core.Expression.eval(Expression.java:101) ~[?:?]
at freemarker.core.MethodCall._eval(MethodCall.java:55) ~[?:?]
at freemarker.core.Expression.eval(Expression.java:101) ~[?:?]
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.process(Environment.java:310) ~[?:?]
at freemarker.template.Template.process(Template.java:383) ~[?:?]
at com.liferay.portal.template.freemarker.internal.FreeMarkerTemplate.lambda$processTemplate$0(FreeMarkerTemplate.java:148) ~[?:?]
at com.liferay.portal.template.freemarker.internal.FreeMarkerManager.render(FreeMarkerManager.java:429) ~[?:?]
at com.liferay.portal.template.freemarker.internal.FreeMarkerTemplate.processTemplate(FreeMarkerTemplate.java:135) ~[?:?]
at com.liferay.portal.template.engine.BaseTemplate.processTemplate(BaseTemplate.java:117) ~[?:?]
... 154 more

Environment

  • Liferay DXP 7.4

Resolution

  • The issue is addressed by LPS-203970.
  • Please request a Hotfix with this fix.

Additional Information

 

 

Did this article resolve your issue ?

Legacy Knowledge Base