Foren

How to share services between two portlets

Dhanush B, geändert vor 9 Jahren.

How to share services between two portlets

Junior Member Beiträge: 56 Beitrittsdatum: 26.08.14 Neueste Beiträge
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, geändert vor 9 Jahren.

RE: How to share services between two portlets

Expert Beiträge: 362 Beitrittsdatum: 09.03.10 Neueste Beiträge
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, geändert vor 9 Jahren.

RE: How to share services between two portlets

Junior Member Beiträge: 56 Beitrittsdatum: 26.08.14 Neueste Beiträge
Hi,
Thanks for your reply manali now it's working fineemoticon
thumbnail
David H Nebinger, geändert vor 7 Jahren.

RE: How to share services between two portlets

Liferay Legend Beiträge: 14919 Beitrittsdatum: 02.09.06 Neueste Beiträge
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, geändert vor 9 Jahren.

RE: How to share services between two portlets

Liferay Legend Beiträge: 14919 Beitrittsdatum: 02.09.06 Neueste Beiträge
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, geändert vor 9 Jahren.

RE: How to share services between two portlets

Junior Member Beiträge: 56 Beitrittsdatum: 26.08.14 Neueste Beiträge
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