掲示板

How to invoke service build in freemarker ADT

7年前 に S H によって更新されました。

How to invoke service build in freemarker ADT

Junior Member 投稿: 30 参加年月日: 16/03/10 最新の投稿
Hi All,

I created one service builder using eclipse sample code

I tried to invoke it by using below line in freemarker ADT
serviceLocator.findService("com.liferay.sample.service.FooLocalServiceUtil")

Below is the error I got.

Expression serviceLocator.findService("com.liferay.sample.service.FooLocalServiceUtil") is undefined on line 71, column 3 in 20155#20195#21307.

Is this the correct way to invoke custom service build in freemarker?
thumbnail
7年前 に Kailash Yadav によって更新されました。

RE: How to invoke service build in freemarker ADT

Regular Member 投稿: 211 参加年月日: 11/10/18 最新の投稿
Try using FooLocalService interface instead of FooLocalServiceUtil class

<#assign fooLocalService= serviceLocator.findService("com.liferay.sample.service.FooLocalService") />


Also check this thread : https://web.liferay.com/community/forums/-/message_boards/message/73391506?_19_threadView=tree
7年前 に S H によって更新されました。

RE: How to invoke service build in freemarker ADT

Junior Member 投稿: 30 参加年月日: 16/03/10 最新の投稿
Thanks for the reply. But I already tried <#assign fooLocalService= serviceLocator.findService("com.liferay.sample.service.FooLocalService") /> , it has similar error

serviceLocator.findService("com.liferay.sample.service.FooLocalService") is undefined.

I also checked the article https://web.liferay.com/community/forums/-/message_boards/message/73391506?_19_threadView=tree, actually I have no issue using the OOTB service, <#assign journalArticleResourceLocalServiceUtil = serviceLocator.findService("com.liferay.portlet.journal.service.JournalArticleLocalService") /> is working for me. My issue happened when using custom service builder.

Kailash Yadav:
Try using FooLocalService interface instead of FooLocalServiceUtil class

&lt;#assign fooLocalService= serviceLocator.findService("com.liferay.sample.service.FooLocalService") /&gt;


Also check this thread : https://web.liferay.com/community/forums/-/message_boards/message/73391506?_19_threadView=tree
7年前 に S H によって更新されました。

RE: How to invoke service build in freemarker ADT (回答)

Junior Member 投稿: 30 参加年月日: 16/03/10 最新の投稿
I found how to use it

serviceLocator.findService("my-service-portlet","com.liferay.sample.service.FooLocalService")