留言板

How to share services between two portlets

Dhanush B,修改在9 年前。

How to share services between two portlets

Junior Member 帖子: 56 加入日期: 14-8-26 最近的帖子
Hi Friends,
i have created two custom portlets for example portlet A and portlet B i want access portlet B services in portlet A for that i followed three ways.
1.copy the jar file of portlet B paste it in global class path and delete jar file from portlet library.(OR )
2.copy the jar file o portlet B paste it in Portlet A library.( OR)
3.Inside liferay plugin.properties add jar file.

i tried with this steps but i am getting exception while accessing the services of portlet B. i have mentioned the exception below..
Please help me how to i clear the exception .



04:18:50,851 ERROR [http-bio-8080-exec-2][render_portlet_jsp:154] org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'com.slayer.service.PodEngineUserLocalService' is defined
at com.liferay.portal.bean.BeanLocatorImpl.doLocate(BeanLocatorImpl.java:137)
at com.liferay.portal.bean.BeanLocatorImpl.locate(BeanLocatorImpl.java:83)
at com.liferay.portal.kernel.bean.PortletBeanLocatorUtil.locate(PortletBeanLocatorUtil.java:47)
at com.slayer.service.PodEngineUserLocalServiceUtil.getService(PodEngineUserLocalServiceUtil.java:310)
at com.slayer.service.PodEngineUserLocalServiceUtil.getPodEngineUsers(PodEngineUserLocalServiceUtil.java:211)
at com.test.hostandpostPortlet.permission(hostandpostPortlet.java:515)
at com.liferay.portal.kernel.portlet.LiferayPortlet.callActionMethod(LiferayPortlet.java:153)
at com.liferay.util.bridges.mvc.MVCPortlet.callActionMethod(MVCPortlet.java:250)
at com.liferay.portal.kernel.portlet.LiferayPortlet.processAction(LiferayPortlet.java:80)
at com.liferay.util.bridges.mvc.MVCPortlet.processAction(MVCPortlet.java:220)
at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:70)
at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:48)
at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:111)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:73)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)









Thanks and Regards
Dhanush
thumbnail
Manali Lalaji,修改在9 年前。

RE: How to share services between two portlets

Expert 帖子: 362 加入日期: 10-3-9 最近的帖子
Hi,

If for your Portlet A you want to access services of portlet B. In liferay-plugin-package.properties file you need to enter below entry.

File liferay-plugin-package.properties you can locate inside WEB-INF folder.
required-deployment-contexts=\
portletB
When you deploy portletA you can check logs. Before deploying portletA it will check for portletB. It shall build portletB first and then copy service jar from portletB into PortletA.

Also refer link

HTH!
Dhanush B,修改在9 年前。

RE: How to share services between two portlets

Junior Member 帖子: 56 加入日期: 14-8-26 最近的帖子
Hi,
Thanks for your reply manali now it's working fineemoticon
thumbnail
David H Nebinger,修改在7 年前。

RE: How to share services between two portlets

Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
No. Portlets do not share context between them; any services, data or beans created in one are not visible or accessible in another.
thumbnail
David H Nebinger,修改在9 年前。

RE: How to share services between two portlets

Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
Actually if I had to guess I'd say maybe there's a newer version of the portletB service jar being used by A, newer in that the service jar refers to the PodEngineUserLocalService bean but if portletB was not deployed with the update, you could get a no such bean exception.

Normally the service build number prevents these kinds of oddballs from coming up, but you could always have a service-ext.properties in portletB that hard-codes the service number (I sometimes do this because I'm only adding to a service layer and don't want to force a redeploy on every dependent portlet).

So the big question is, did you deploy the updated portletB or are you only pushing out the updated service jar in each of the ways listed?
Dhanush B,修改在9 年前。

RE: How to share services between two portlets

Junior Member 帖子: 56 加入日期: 14-8-26 最近的帖子
Thanks for your reply David,

I have deployed updated service jar only i got your point now what i did is i copied the jar file and paste it in globalclasspath and can you please give one example for me how to change build number using service-ext.properties.
But now my issue was cleared i followed what Manali suggested me.

Thanks & Regards
Dhanush