David H Nebinger:
Yes, you're incorrectly referencing a local service instance within the impl class.
The impl class has access to everything you need (it extends the appropriate base classes, has access to the persistence layer, etc.). You shouldn't be trying to get an actual instance pointer to the local service, just use what's available or fall back to the BlahLocalServiceUtil() class if you're going outside of your current impl class.
Hello David,
Thanks for the response firstly.
Well, I got your point and I am not trying to get instance of local service directly, I am using simply the method being generated by service builder.
Below you can seen the code snippet (hope this make sense and make situation clear to you)
In view jsp<%
List<AssetEntry> listEntry = (List<AssetEntry>)ArticleDisplayListLocalServiceUtil.getArticlesByCurrentAuthor(groupId, userId);
Iterator<AssetEntry> itrEnteries = listEntry.iterator();
while (itrEnteries.hasNext()) {
...........
In ArticleDisplayListLocalServiceUtil.java public static java.util.List<com.liferay.portlet.asset.model.AssetEntry> getArticlesByCurrentAuthor(
long groupId, long userId)
throws com.liferay.portal.kernel.exception.SystemException {
return getService().getArticlesByCurrentAuthor(groupId, userId);
}
//call to get the local service instance.public static ArticleDisplayListLocalService getService() {
if (_service == null) {
_service = (ArticleDisplayListLocalService)PortalBeanLocatorUtil.locate(ArticleDisplayListLocalService.class.getName());
}
return _service;
}
Any suggestions??
Thanks
Ruchi
Please sign in to flag this as inappropriate.