<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>Can't get a category property at FTL</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=121221196" />
  <subtitle>Can't get a category property at FTL</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=121221196</id>
  <updated>2026-04-06T22:39:35Z</updated>
  <dc:date>2026-04-06T22:39:35Z</dc:date>
  <entry>
    <title>RE: Can't get a category property at FTL</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121260840" />
    <author>
      <name>Mohammed Yasin</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121260840</id>
    <updated>2021-11-25T07:50:18Z</updated>
    <published>2021-11-25T07:48:46Z</published>
    <summary type="html">&lt;p&gt;Hi ,&lt;/p&gt;
&lt;p&gt;You can try using below code  for fetching the AssetCategoryProperty.&lt;/p&gt;
&lt;pre&gt;
&lt;code class="language-html"&gt;&amp;lt;#assign 					
	assetCategoryPropService = serviceLocator.findService(&amp;quot;com.liferay.asset.category.property.service.AssetCategoryPropertyLocalService&amp;quot;)
	catPropValue = assetCategoryPropService.getCategoryProperty(categoryId,&amp;quot;propertyName&amp;quot;)
/&amp;gt;
${catPropValue.getValue()}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;</summary>
    <dc:creator>Mohammed Yasin</dc:creator>
    <dc:date>2021-11-25T07:48:46Z</dc:date>
  </entry>
  <entry>
    <title>Can't get a category property at FTL</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121221195" />
    <author>
      <name>Karmel Idarraga</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121221195</id>
    <updated>2021-10-28T09:11:22Z</updated>
    <published>2021-10-28T06:31:16Z</published>
    <summary type="html">&lt;p&gt;Hi all!! &lt;/p&gt;
&lt;p&gt;I have an Freemarker category navigation template which needs no get
  a category custom property. My code was working until er hace upgrade
  from Liferay 7.3 CE GA6 to Liferay 7.3 GA8.&lt;/p&gt;
&lt;p&gt;Now we are getting the following error:&lt;/p&gt;
&lt;p&gt;com.sun.proxy.$Proxy1796 cannot be cast to com.liferay.asset.category.property.model.AssetCategoryProperty.&lt;/p&gt;
&lt;p&gt;At GA6 we have the following ftl working:&lt;/p&gt;
&lt;pre&gt;
&lt;code class="language-javascript"&gt;&amp;lt;#assign assetCategory = serviceLocator.findService(&amp;quot;com.liferay.asset.category.property.service.impl.AssetCategoryPropertyLocalServiceImpl&amp;quot;)&amp;gt;
&amp;lt;#assign assetCategoryNuevo = serviceLocator.findService(&amp;quot;com.liferay.portlet.asset.service.impl.AssetCategoryPropertyServiceImpl&amp;quot;)&amp;gt;
&amp;lt;#assign images_folder = themeDisplay.getPathThemeImages()&amp;gt;
&amp;lt;#if entries?has_content&amp;gt;
&amp;lt;div class=&amp;quot;container my-5&amp;quot;&amp;gt;
    &amp;lt;h2 class=&amp;quot;mb-5&amp;quot;&amp;gt;&amp;lt;@liferay.language key=&amp;quot;DOG-ADT-catalogo-opendata-header&amp;quot;/&amp;gt;&amp;lt;/h2&amp;gt;
	&amp;lt;#list entries as curVocabulary&amp;gt;
	    &amp;lt;#assign categories = curVocabulary.getCategories() /&amp;gt;
	    &amp;lt;#if categories?has_content&amp;gt;
	        &amp;lt;@displayCategories categories=categories /&amp;gt;
	    &amp;lt;/#if&amp;gt;
	&amp;lt;/#list&amp;gt;
	&amp;lt;/div&amp;gt;
&amp;lt;/#if&amp;gt;

&amp;lt;#macro displayCategories
	categories
&amp;gt;
	&amp;lt;#if categories?has_content&amp;gt;
	    &amp;lt;div class=&amp;quot;row&amp;quot;&amp;gt;
			&amp;lt;#list categories as category&amp;gt;
                &amp;lt;#assign key = category.getCategoryId()&amp;gt;
                &amp;lt;#assign valorPropiedad = assetCategoryNuevo.getCategoryProperty(key,&amp;quot;image&amp;quot;)&amp;gt;
                &amp;lt;a href=&amp;quot;${categoryURL}${key}&amp;quot; class=&amp;quot;ficha-categoria&amp;quot;&amp;gt; 
                    &amp;lt;img src=&amp;quot;${images_folder}/opendata/${valorPropiedad.getValue()}&amp;quot; &amp;gt;
                    &amp;lt;p&amp;gt;${category.getTitle(locale)}&amp;lt;/p&amp;gt;
                &amp;lt;/a&amp;gt;
			&amp;lt;/#list&amp;gt;
		&amp;lt;/div&amp;gt;	
	&amp;lt;/#if&amp;gt;
&amp;lt;/#macro&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When the upgrade was done, we get an error because the service was
  removed (or changed the location), so we changed it to use the following:&lt;/p&gt;
&lt;blockquote&gt;
  &lt;p&gt;&amp;lt;#assign assetCategoryKernel = serviceLocator.findService(&amp;quot;com.liferay.asset.kernel.service.AssetCategoryPropertyLocalService&amp;quot;)&amp;gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;But now we are getting the following error:&lt;/p&gt;
&lt;blockquote&gt;
  &lt;p&gt;Caused by: java.lang.ClassCastException: com.sun.proxy.$Proxy1796
    cannot be cast to
    com.liferay.asset.category.property.model.AssetCategoryProperty&lt;br /&gt;
        at
    com.liferay.portal.template.freemarker.internal.RestrictedLiferayObjectWrapper.wrap(RestrictedLiferayObjectWrapper.java:229)&lt;br /&gt;
        at
    freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:1509)&lt;br /&gt;
        at
    freemarker.ext.beans.ReflectionCallableMemberDescriptor.invokeMethod(ReflectionCallableMemberDescriptor.java:56)&lt;br /&gt;
        at
    freemarker.ext.beans.MemberAndArguments.invokeMethod(MemberAndArguments.java:51)&lt;br /&gt;
        at
    freemarker.ext.beans.OverloadedMethodsModel.exec(OverloadedMethodsModel.java:61)&lt;br /&gt;
        ... 278 more&lt;br /&gt;  &lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Can anyone help us, please?&lt;/p&gt;
&lt;p&gt;Thanks in advance&lt;/p&gt;</summary>
    <dc:creator>Karmel Idarraga</dc:creator>
    <dc:date>2021-10-28T06:31:16Z</dc:date>
  </entry>
</feed>
