Legacy Knowledge Base
Published Jun. 30, 2025

Resolve NPE / NullPointerException from FreeMarker template

Written By

Laura Li

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

  • The following error is observed repeatedly in the log:
    ERROR [default task-522][runtime:60] Error executing FreeMarker template
    FreeMarker template error:
    Java method "com.liferay.portlet.expando.model.impl.ExpandoBridgeImpl.getAttribute(String)" threw an exception when invoked on com.liferay.portlet.expando.model.impl.ExpandoBridgeImpl object "com.liferay.portlet.expando.model.impl.ExpandoBridgeImpl@321baf4e"; see cause exception in the Java stack trace.
    
    ----
    FTL stack trace ("~" means nesting-related):
        - Failed at: #assign googleSite = themeDisplay.get...  [in template "portal-theme_SERVLET_CONTEXT_/templates/google_site.ftl" at line 2, column 1]
        - Reached through: #include "${full_templates_path}/goog...  [in template "portal-theme_SERVLET_CONTEXT_/templates/portal_normal.ftl" at line 24, column 11]
    ----
    
    Java stack trace (for programmers):
    ----
    freemarker.core._TemplateModelException: [... Exception message was already printed; see it above ...]
        at freemarker.ext.beans._MethodUtil.newInvocationTemplateModelException(_MethodUtil.java:311)
        at freemarker.ext.beans._MethodUtil.newInvocationTemplateModelException(_MethodUtil.java:284)
        at freemarker.ext.beans.OverloadedMethodsModel.exec(OverloadedMethodsModel.java:68)
    ...
    Caused by: java.lang.RuntimeException: java.lang.NullPointerException
        at com.liferay.portlet.expando.model.impl.ExpandoBridgeImpl.getAttribute(ExpandoBridgeImpl.java:218)
        at com.liferay.portlet.expando.model.impl.ExpandoBridgeImpl.getAttribute(ExpandoBridgeImpl.java:198)
        at sun.reflect.GeneratedMethodAccessor923.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:1458)
        at freemarker.ext.beans.ReflectionCallableMemberDescriptor.invokeMethod(ReflectionCallableMemberDescriptor.java:52)
        at freemarker.ext.beans.MemberAndArguments.invokeMethod(MemberAndArguments.java:48)
        at freemarker.ext.beans.OverloadedMethodsModel.exec(OverloadedMethodsModel.java:62)
        ... 187 more
    Caused by: java.lang.NullPointerException
        at com.liferay.portlet.expando.service.permission.ExpandoColumnPermissionImpl.contains(ExpandoColumnPermissionImpl.java:73)
        at com.liferay.expando.kernel.service.permission.ExpandoColumnPermissionUtil.contains(ExpandoColumnPermissionUtil.java:57)
        at com.liferay.portlet.expando.service.impl.ExpandoValueServiceImpl.getData(ExpandoValueServiceImpl.java:121)
    ...
          

 

Environment

  • Liferay DXP 7.1 

 

Resolution

  • Please install fix pack 27
  • Or request a hotfix with the LPS-130454

 

 

Did this article resolve your issue ?

Legacy Knowledge Base