3/17/2011

Bug in Liferay 6.0.10 ? Accessing a Portlet´s Service from another Portlet

If you want to access a Service that has been defined by Portlet A by Portlet B you would normally do this :


http://liferay-blogging.blogspot.com/2011/03/liferay-portlets-accessing-services-of.html

But what if you get this Exception :

java.lang.NullPointerException
at com.liferay.socialnetworking.service.WallEntryLocalServiceClp.<init>(WallEntryLocalServiceClp.java:598)
at com.liferay.socialnetworking.service.WallEntryLocalServiceUtil.getService(WallEntryLocalServiceUtil.java:290)
at com.liferay.socialnetworking.service.WallEntryLocalServiceUtil.dynamicQuery(WallEntryLocalServiceUtil.java:98)
at ...





Well, then it might be that you have running Liferay 6.0.10, which (to me ) seems to have a bug which results in returning null instead of a classloaderproxy. So - what is to be done ?


1) Migrate to 6.0.11 - The Bug is fixed there or


2) Define all Services you wish to access AGAIN in the accessing portlet. If you use the "table" property, you make sure, the services access the same table. Here is an example to access the table of the chat portlet:


<entity name="Entry"  table="chat_entry"  local-service="true" remote-service="false">...</entity>




If you like this tutorial it would be very nice, if you could click on some of the google ads you see on the right side. It helps me run this block and motivates me ;)

If you have any questions, feel free to leave a comment.