Forums de discussion

Access utilLocator.findUtil in freemarker theme liferay 7

Hardik Sanghani, modifié il y a 6 années.

Access utilLocator.findUtil in freemarker theme liferay 7

Junior Member Publications: 40 Date d'inscription: 16/02/15 Publications récentes
Hello,

I need to access utilLocator.findUtil in freemarker, I am not able to access it throws null pointer.

I can access serviceLocator easily.

Can you anyone know how can I access utilLocator ?

Thank you
Hardik
Sourabh Lonikar, modifié il y a 6 années.

RE: Access utilLocator.findUtil in freemarker theme liferay 7

Junior Member Publications: 42 Date d'inscription: 14/11/16 Publications récentes
Any update on this ? I am also facing same issue in DXP.
thumbnail
Massimo Bevilacqua, modifié il y a 6 années.

RE: Access utilLocator.findUtil in freemarker theme liferay 7

Regular Member Publications: 210 Date d'inscription: 27/12/16 Publications récentes
Could you paste your code?
Sourabh Lonikar, modifié il y a 6 années.

RE: Access utilLocator.findUtil in freemarker theme liferay 7

Junior Member Publications: 42 Date d'inscription: 14/11/16 Publications récentes
Hi Massimo,
PFB code responsible for error. The error is coming for 'serviceLocator' variable. We had no issue in Liferay 6.2 but in Liferay DXP getting this error.

serviceLocator.findService("com.liferay.portlet.documentlibrary.service.DLFileEntryTypeLocalService") />

Regards,
Sourabh
thumbnail
Massimo Bevilacqua, modifié il y a 6 années.

RE: Access utilLocator.findUtil in freemarker theme liferay 7

Regular Member Publications: 210 Date d'inscription: 27/12/16 Publications récentes
Hi,

from liferay 6 to 7 some classes are changed. Use this(I tested it and it works...but I have Liferay 7 not DXP):

<#assign testLocalService = serviceLocator.findService("com.liferay.document.library.kernel.service.DLFileEntryTypeLocalService") />


com.liferay.document.library.kernel.service.DLFileEntryTypeLocalService (Liferay 7)
com.liferay.portlet.documentlibrary.service.DLFileEntryTypeLocalService(Liferay 6)

remeber to add this lines to your "portal-ext.properties"

freemarker.engine.restricted.classes=
freemarker.engine.restricted.packages=
freemarker.engine.restricted.variables=