title: Liferay 7 Freemarker Template - Get Articles Categories
body: <p>Hi fellow Liferay'ers,</p>
  
  <p>I'm trying to get the categories of a journalArticle with a Freemarker template.</p>
  
  <p>I tried this code:</p>
  
  <pre><code>   &lt;#assign journalArticleId = .vars['reserved-article-id'].data&gt;
  &lt;#assign journalArticleResourceLocalServiceUtil = staticUtil["com.liferay.portlet.journal.service.JournalArticleResourceLocalServiceUtil"]&gt;
  &lt;#assign assetCategoryLocalServiceUtil = staticUtil["com.liferay.portlet.asset.service.AssetCategoryLocalServiceUtil"]&gt;
  
  &lt;#assign articleResourcePK = journalArticleResourceLocalServiceUtil.getArticleResourcePrimKey(groupId, journalArticleId)/&gt;
  &lt;#assign categoryList=assetCategoryLocalServiceUtil.getCategories("com.liferay.portlet.journal.model.JournalArticle",articleResourcePK) &gt;
  
  &lt;#list categoryList as categoryList&gt;
  ${categoryList.getName()}
  &lt;/#list&gt;
  </code></pre>
  
  <p>When i execute the code it throws this error:</p>
  
  <pre><code>08:26:30,582 ERROR [http-nio-8080-exec-10][runtime:60] Error executing FreeMarker template
  FreeMarker template error:
  The following has evaluated to null or missing:
  ==&gt; staticUtil  [in template "20202#20246#41671" at line 14, column 51]
  
  ----
  Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use &lt;#if myOptionalVar??&gt;when-present&lt;#else&gt;when-missing&lt;/#if&gt;. (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: #assign journalArticleResourceLocalSe...  [in template "20202#20246#41671" at line 14, column 1]
  ----
  
  Java stack trace (for programmers):
  ----
  </code></pre>
  
  <p>Does anyone has an Idea what I am doing wrong here?
  Thank you in advance.</p>