legacy-knowledge-base
公開されました Jun. 30, 2025

FreeMarkerテンプレートのNPE / NullPointerExceptionを解決する。

written-by

Laura Li

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

learn-legacy-article-disclaimer-text

問題

  • ログを見ると、以下のようなエラーが繰り返し観測されます:
    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)
    ...
          

環境

  • Liferay DXP 7.1

解像度

  • フィックスパック27をインストールしてください
  • または、 LPS-130454でHotfixをリクエストしてください。

did-this-article-resolve-your-issue

legacy-knowledge-base