Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
How to use one plugins portlet in another Gurumurthy Godlaveeti April 17, 2012 4:27 AM
RE: How to use one plugins portlet in another David H Nebinger April 17, 2012 7:34 AM
RE: How to use one plugins portlet in another Gurumurthy Godlaveeti April 30, 2012 5:18 AM
RE: How to use one plugins portlet in another Muhammed Shakir June 16, 2012 12:05 AM
RE: How to use one plugins portlet in another Muhammed Shakir June 16, 2012 12:06 AM
RE: How to use one plugins portlet in another David H Nebinger June 16, 2012 8:08 AM
RE: How to use one plugins portlet in another Pietro Santoro October 30, 2012 11:09 AM
RE: How to use one plugins portlet in another David H Nebinger October 30, 2012 12:17 PM
RE: How to use one plugins portlet in another Rishi Dev Gupta October 30, 2012 9:53 PM
RE: How to use one plugins portlet in another Rishi Dev Gupta October 30, 2012 11:14 PM
RE: How to use one plugins portlet in another David H Nebinger October 31, 2012 5:43 AM
RE: How to use one plugins portlet in another meera prince February 12, 2013 8:44 PM
RE: How to use one plugins portlet in another Siby Mathew February 13, 2013 5:13 AM
RE: How to use one plugins portlet in another meera prince February 13, 2013 5:20 AM
RE: How to use one plugins portlet in another David H Nebinger February 13, 2013 5:28 AM
RE: How to use one plugins portlet in another meera prince February 13, 2013 5:37 AM
RE: How to use one plugins portlet in another Siby Mathew February 13, 2013 5:32 AM
RE: How to use one plugins portlet in another meera prince February 13, 2013 5:39 AM
RE: How to use one plugins portlet in another Siby Mathew February 13, 2013 5:46 AM
RE: How to use one plugins portlet in another meera prince February 13, 2013 5:54 AM
RE: How to use one plugins portlet in another Kalai arasan August 31, 2013 3:46 AM
RE: How to use one plugins portlet in another Kalai arasan September 5, 2013 9:33 PM
RE: How to use one plugins portlet in another Kalai arasan July 26, 2013 1:23 AM
RE: How to use one plugins portlet in another David H Nebinger July 26, 2013 5:20 AM
RE: How to use one plugins portlet in another Kalai arasan July 28, 2013 9:53 PM
RE: How to use one plugins portlet in another David H Nebinger July 29, 2013 5:26 AM
RE: How to use one plugins portlet in another Kalai arasan July 30, 2013 9:17 PM
RE: How to use one plugins portlet in another David H Nebinger July 31, 2013 6:12 AM
RE: How to use one plugins portlet in another Kalai arasan August 26, 2013 1:16 AM
Gurumurthy Godlaveeti
How to use one plugins portlet in another
April 17, 2012 4:27 AM
Answer

Gurumurthy Godlaveeti

Rank: Regular Member

Posts: 126

Join Date: August 11, 2011

Recent Posts

Hi Everybody ,
I am using Liferay 6.0.6 with MySQL and Tomcat 6.0.29 .
I have producer plugins portlet and I want to make it available for all consumer portlet . How can I ?
Actually I kept Producer plugins portlet service.jar file into server/lib folder so I am able to use it in all consumer portlet but i don't want like this . I want to provide it by just adding one property in "liferay-plugin-package.properties " in all consumer portlet just like how we are adding the dependency jar files to plugins portlet .

1
2portal.dependency.jars=\antlr.jar,\commons-beanutils.jar,\commons-collections.jar,\commons-digester.jar,\commons-fileupload.jar,\commons-io.jar,\ commons-lang.jar,\commons-validator.jar,\jcommon.jar,\jfreechart.jar,\oro.jar,\portals-bridges.jar,\struts.jar,\jstl.jar,\jstl-impl.jar,\portal-service.jar
3
4portal.dependency.tlds=struts-bean.tld,struts-bean-el.tld,struts-html.tld,struts-html-el.tld,struts-logic.tld,struts-logic-el.tld,struts-nested.tld,struts-tiles.tld,struts-tiles-el.tld,liferay-ui.tld,c-rt.tld


Just like above properties , Is there any other properties which is useful to use one plugins portlet in another ?
David H Nebinger
RE: How to use one plugins portlet in another
April 17, 2012 7:34 AM
Answer

David H Nebinger

Rank: Liferay Legend

Posts: 5734

Join Date: September 1, 2006

Recent Posts

Just use the required deployment context in the consumer portlets. Add the producer as the required context. Service jar will be shared automatically.
Gurumurthy Godlaveeti
RE: How to use one plugins portlet in another
April 30, 2012 5:18 AM
Answer

Gurumurthy Godlaveeti

Rank: Regular Member

Posts: 126

Join Date: August 11, 2011

Recent Posts

Hi David ,

I made producer portlet and i deployed it also , after that i made one consumer portlet and i wrote required-deployment-context property in consumer liferay-plugin-package.properties file , see it below .

required-deployment-contexts = producer-portlet


But still i am unable to use producer-portlet service layer util classes . Let me know if i done any wrong step in this process .

Did u try it ? if yes then please forward skeleton of liferay-plugin-package.properties file also .

Thanks ,
G.Gurumurthy .
Muhammed Shakir
RE: How to use one plugins portlet in another
June 16, 2012 12:05 AM
Answer

Muhammed Shakir

Rank: Junior Member

Posts: 33

Join Date: February 25, 2009

Recent Posts

Hi David,

Have you tried this your self ?
Muhammed Shakir
RE: How to use one plugins portlet in another
June 16, 2012 12:06 AM
Answer

Muhammed Shakir

Rank: Junior Member

Posts: 33

Join Date: February 25, 2009

Recent Posts

David H Nebinger:
Just use the required deployment context in the consumer portlets. Add the producer as the required context. Service jar will be shared automatically.


Have you tried this yourself David ?
David H Nebinger
RE: How to use one plugins portlet in another
June 16, 2012 8:08 AM
Answer

David H Nebinger

Rank: Liferay Legend

Posts: 5734

Join Date: September 1, 2006

Recent Posts

Yes, we use this method exclusively in our production systems as it saves having to move jars to lib/ext and the inevitable stop/start of the application container (basically we can hot deploy these guys and it just works).

We have one portlet project that has the only service builder-managed service layer. We wanted to keep all of our extraneous data access stuff in a single project to keep the architecture simple.

All of our other separate portlet projects need the data services provided by this project, so in the liferay-plugin-package.properties file, the service providing plugin is added as a required deployment context.

Most of the magic is enforced by the IDE, so you must be using the IDE also (I don't know if there are plans to include the magic into the ant build process, but it would be nice if they did emoticon ).

Anyways the dependent projects will get updated service jars (prior to build/deploy time) and they can access the service layer provided by the service providing project.

The Liferay runtime will not complete the initialization of a project with an unsatisfied required deployment context, so the dependent projects sit in a queue at startup until the required deployment context entities have been properly loaded and initialized. So they will wait until the service providing portlet is loaded, then they will be loaded afterwards. Saves on all of those typical 'BeanLocator' exceptions, too.
Pietro Santoro
RE: How to use one plugins portlet in another
October 30, 2012 11:09 AM
Answer

Pietro Santoro

Rank: New Member

Posts: 16

Join Date: May 4, 2008

Recent Posts

Hi David,
this works with LR 5.1.2? Or only with LR 6.x?

Thanks

Pietro

David H Nebinger:
Yes, we use this method exclusively in our production systems as it saves having to move jars to lib/ext and the inevitable stop/start of the application container (basically we can hot deploy these guys and it just works).

We have one portlet project that has the only service builder-managed service layer. We wanted to keep all of our extraneous data access stuff in a single project to keep the architecture simple.

All of our other separate portlet projects need the data services provided by this project, so in the liferay-plugin-package.properties file, the service providing plugin is added as a required deployment context.

Most of the magic is enforced by the IDE, so you must be using the IDE also (I don't know if there are plans to include the magic into the ant build process, but it would be nice if they did emoticon ).

Anyways the dependent projects will get updated service jars (prior to build/deploy time) and they can access the service layer provided by the service providing project.

The Liferay runtime will not complete the initialization of a project with an unsatisfied required deployment context, so the dependent projects sit in a queue at startup until the required deployment context entities have been properly loaded and initialized. So they will wait until the service providing portlet is loaded, then they will be loaded afterwards. Saves on all of those typical 'BeanLocator' exceptions, too.
David H Nebinger
RE: How to use one plugins portlet in another
October 30, 2012 12:17 PM
Answer

David H Nebinger

Rank: Liferay Legend

Posts: 5734

Join Date: September 1, 2006

Recent Posts

I don't believe so...

Even though the magic is performed by the IDE (for the jar file moving), I don't think 5.x used the liferay-plugin-package.properties file where you define the required deployment context...
Rishi Dev Gupta
RE: How to use one plugins portlet in another
October 30, 2012 9:53 PM
Answer

Rishi Dev Gupta

Rank: Expert

Posts: 252

Join Date: November 23, 2008

Recent Posts

David H Nebinger:
I don't believe so...

Even though the magic is performed by the IDE (for the jar file moving), I don't think 5.x used the liferay-plugin-package.properties file where you define the required deployment context...



IDE can assist in development and can allow defining various properties in easily readable form, but i don't think that IDE will just move the service jar from one portlet to another. Because all the dependency jars are copied during the process of deployment of portlet.

Earlier i have done this by moving the service jars to tomcat lib and then used services in other portlets.

Still I will give a try to this.
Rishi Dev Gupta
RE: How to use one plugins portlet in another
October 30, 2012 11:14 PM
Answer

Rishi Dev Gupta

Rank: Expert

Posts: 252

Join Date: November 23, 2008

Recent Posts

Bingo this works...
It is done by Liferay's deployment API and not by IDE. Thus when hot portlet deployment is done, it looks for the defined dependency context's and copies the service jar to the portlet and then completes the deployment.

One more thing, if i have 2 portlets A and B. B is dependent on A.
I have deployed A and then B, thus As B have dependency on A.
Now after successful deployment of B, it will have service jar of A copied locally.

Suppose in future i just update the service for A and redeploy it, will this modified service jar of A be synched with existing portlet B also or will both A and B have 2 different version jars and i have to redeploy B later?
David H Nebinger
RE: How to use one plugins portlet in another
October 31, 2012 5:43 AM
Answer

David H Nebinger

Rank: Liferay Legend

Posts: 5734

Join Date: September 1, 2006

Recent Posts

I don't know that this is accurate...

Start a project C and declare that it is a dependency on A in liferay-plugin-package.properties, but don't build or deploy the project. If you check C's WEB-INF/lib directory, you'll see A's service jar in there. This allows code added to C in the IDE to reference the service classes and not display compile/link errors.

This indicates that it is a function of the IDE. At deploy time the service jar is already there so it doesn't need to get pulled in during deployment.

As far as hot deploy goes, under 6.0 the hot deploy process is not pulling in the service jar at deploy time. 6.1 might do it, but I don't know that it does.

Since it is a function of the IDE and not the deploy process, A's service jar does not get propagated when you deploy an update for A. You must rebuild and redeploy the depending portlets for the updated service jar to get deployed.
meera prince
RE: How to use one plugins portlet in another
February 12, 2013 8:44 PM
Answer

meera prince

Rank: Liferay Master

Posts: 688

Join Date: February 8, 2011

Recent Posts

Hi David H Nebinger,
I have used required deployment context for one my portlet but this is not working. i am using liferay 6.0.6 .
When i used this property the compilation errors was resolved in the IDE. once deploy the portlets when run then i got following error. one more thing after deploy when i looked into portlet in tomacat webapp directory. the sharable service jar not availbale in WEB-INF/lib of required portlet. i want clear one thing sharable service jar should available in portlet WEB_INF/lib or not.

The following is exception

java.lang.NullPointerException
at com.vidyayug.global.service.RoleLandingPageLocalServiceClp.<init>(RoleLandingPageLocalServiceClp.java:474)
at com.vidyayug.global.service.RoleLandingPageLocalServiceUtil.getService(RoleLandingPageLocalServiceUtil.java:262)
at com.vidyayug.global.service.RoleLandingPageLocalServiceUtil.getRoleLandingPage(RoleLandingPageLocalServiceUtil.java:170)

Regards,
Meera Prince
Siby Mathew
RE: How to use one plugins portlet in another
February 13, 2013 5:13 AM
Answer

Siby Mathew

Rank: Expert

Posts: 256

Join Date: March 4, 2011

Recent Posts

Hi Meera,
If you keep it in required-deployment-contexts, the dependent service jar WILL BE copied in the deployed war.

Thanks,
Siby
meera prince
RE: How to use one plugins portlet in another
February 13, 2013 5:20 AM
Answer

meera prince

Rank: Liferay Master

Posts: 688

Join Date: February 8, 2011

Recent Posts

HI thank you Siby Mathew,

That was not happens in liferay6.0.6.
when i looked into tomcat deployed portlet lib i could not find the service jar.
i manually copy in tomcat webapp portlet context lib directory. then i got null pointer exception.
Please go through the my link and see my post there.
Regards
Meera Prince
http://www.liferaysavvy.com/
David H Nebinger
RE: How to use one plugins portlet in another
February 13, 2013 5:28 AM
Answer

David H Nebinger

Rank: Liferay Legend

Posts: 5734

Join Date: September 1, 2006

Recent Posts

The service jar is only copied if you are using the Liferay IDE. If you are not using the IDE, or you are relying strictly on ant, you must copy the service jar manually.
Siby Mathew
RE: How to use one plugins portlet in another
February 13, 2013 5:32 AM
Answer

Siby Mathew

Rank: Expert

Posts: 256

Join Date: March 4, 2011

Recent Posts

Hi Meera,
Which post do you mean ?
You mean you tried to copy the file manually to lib of webapps/yourportlet and still got a NPE ?
In case you are manually entering the dependency, please make sure the text is same as this (with hyphens) :
required-deployment-contexts=

Thanks,
Siby
meera prince
RE: How to use one plugins portlet in another
February 13, 2013 5:37 AM
Answer

meera prince

Rank: Liferay Master

Posts: 688

Join Date: February 8, 2011

Recent Posts

Hi David H Nebinger,
I observed that LiferayIDE not doing that actions. Because i went through the portlet lib which is in tomcat server.

i am using LiferayIDE1.4 and Liferay60.6
Here one question i have. If i use service jar in different portlets by using required-deployment-context property late if i updated or add some new methods in service jar what will happend?
Weather all contexts which uses service jar updated automatically or we need to take care each and every portlet


Regards,
Meera Prince
http://www.liferaysavvy.com/
meera prince
RE: How to use one plugins portlet in another
February 13, 2013 5:39 AM
Answer

meera prince

Rank: Liferay Master

Posts: 688

Join Date: February 8, 2011

Recent Posts

Hi Siby Mathew the following post i said.

I have used required deployment context for one my portlet but this is not working. i am using liferay 6.0.6 .
When i used this property the compilation errors was resolved in the IDE. once deploy the portlets when run then i got following error. one more thing after deploy when i looked into portlet in tomacat webapp directory. the sharable service jar not availbale in WEB-INF/lib of required portlet. i want clear one thing sharable service jar should available in portlet WEB_INF/lib or not.

The following is exception

java.lang.NullPointerException
at com.vidyayug.global.service.RoleLandingPageLocalServiceClp.<init>(RoleLandingPageLocalServiceClp.java:474)
at com.vidyayug.global.service.RoleLandingPageLocalServiceUtil.getService(RoleLandingPageLocalServiceUtil.java:262)
at com.vidyayug.global.service.RoleLandingPageLocalServiceUtil.getRoleLandingPage(RoleLandingPageLocalServiceUtil.java:170)

Regards,
Meera Prince
Siby Mathew
RE: How to use one plugins portlet in another
February 13, 2013 5:46 AM
Answer

Siby Mathew

Rank: Expert

Posts: 256

Join Date: March 4, 2011

Recent Posts

Hi Meera,
The expected behaviour is :
- The shared service jar should be present in the deployed war.

- Consider Portlet B is dependent on PortletA.
- portletA-service.jar should be present inside Portlet-B.war during deployment.

I assume PortletA has been already deployed by you. Am I right ?
If not, PortletB will wait in queue till PortletA is deployed. Can you make sure that its not in queue ?

Thanks,
Siby
meera prince
RE: How to use one plugins portlet in another
February 13, 2013 5:54 AM
Answer

meera prince

Rank: Liferay Master

Posts: 688

Join Date: February 8, 2011

Recent Posts

Hi Siby Mathew
first i deployed PortletA and then i have used required-deployment-context=PortletA
in PortletB and then i deployed portletB.

After deployment i got class not found exception. then i looked into deployed war of portletB i could not found PortletA-service.jar in lib directory of PortletB war in tomcat server.
then i just manually copy the portletA-service.jar to lib of PortletB war which in tomcat server.
then i got following exception

java.lang.NullPointerException
at com.vidyayug.global.service.RoleLandingPageLocalServiceClp.<init>(RoleLandingPageLocalServiceClp.java:474)
at com.vidyayug.global.service.RoleLandingPageLocalServiceUtil.getService(RoleLandingPageLocalServiceUtil.java:262)
at com.vidyayug.global.service.RoleLandingPageLocalServiceUtil.getRoleLandingPage(RoleLandingPageLocalServiceUtil.java:170)



Regards,
Meera Prince
http://www.liferaysavvy.com/
Kalai arasan
RE: How to use one plugins portlet in another
July 26, 2013 1:23 AM
Answer

Kalai arasan

Rank: Junior Member

Posts: 67

Join Date: January 2, 2013

Recent Posts

Hi!
I access the project A from Project B by required deployment context. but i can't use finder method for access the tables from project B while the table is in Project A!
If you have solution for this problem reply me hoe to use finder method for access Project A from Project B.
David H Nebinger
RE: How to use one plugins portlet in another
July 26, 2013 5:20 AM
Answer

David H Nebinger

Rank: Liferay Legend

Posts: 5734

Join Date: September 1, 2006

Recent Posts

Finders are not exposed in the service tier. Go into your XxxLocalServiceImpl class and add a method to expose what you're going for (i.e. create a pass through method in Impl that invokes the method in the finder).

Rebuild services and you'll be good to go.
Kalai arasan
RE: How to use one plugins portlet in another
July 28, 2013 9:53 PM
Answer

Kalai arasan

Rank: Junior Member

Posts: 67

Join Date: January 2, 2013

Recent Posts

Hi!
I build the service for finder method In, ApplicationfulldetailsLocalServiceImpl as
public java.util.List<com.test.model.Applicationfulldetails> findByApplicationno(String Applicationno)
throws com.liferay.portal.kernel.exception.SystemException {
return ApplicationfulldetailsUtil.findByApplicationno(Applicationno);
}

After deployment context, it works for Project A. Then the entity can be accessible by Project B. But i can't use the finder for Project B, while it works in Project A.?
David H Nebinger
RE: How to use one plugins portlet in another
July 29, 2013 5:26 AM
Answer

David H Nebinger

Rank: Liferay Legend

Posts: 5734

Join Date: September 1, 2006

Recent Posts

findByApplicationno() implementation should use the custom finder, not call the Util class...
Kalai arasan
RE: How to use one plugins portlet in another
July 30, 2013 9:17 PM
Answer

Kalai arasan

Rank: Junior Member

Posts: 67

Join Date: January 2, 2013

Recent Posts

Ok i understand. But how can i access the util class?
David H Nebinger
RE: How to use one plugins portlet in another
July 31, 2013 6:12 AM
Answer

David H Nebinger

Rank: Liferay Legend

Posts: 5734

Join Date: September 1, 2006

Recent Posts

Okay, you have two different things here, a service provider and a service consumer.

The service provider has the service.xml file and all of the XxxLocalServiceImpl classes. In here you'd define a method, findByMyCustomFinder() that takes appropriate arguments and returns the list. Since it is an implementation class, it has full access to the persistence layer, the custom finders, and all of the other service builder goodies. And since these are the implementation classes, they should never be using the XxxLocalServiceUtil classes because they are only for consumers. Whatever you want to expose to the consumer, you must put it in XxxLocalServiceImpl as public methods.

The service consumer can only use the XxxLocalServiceUtil classes and the corresponding model interfaces. It has no access to the custom finders or persistence layer or anything. Whatever you want to expose for the consumer to use, they can only get to it through the XxxLocalServiceUtil classes. The service consumer will add an entry in liferay-plugin-package.properties file for a required deployment context, the entry will be the service provider. The Liferay IDE will automagically copy the service jar into your project so the XxxLocalServiceUtil classes are available.
Kalai arasan
RE: How to use one plugins portlet in another
August 26, 2013 1:16 AM
Answer

Kalai arasan

Rank: Junior Member

Posts: 67

Join Date: January 2, 2013

Recent Posts

Hi!
when i first start the server both projects will work fine. But when deploy the projects again there is an exception named nosuchBeanDefinitionException will occurs in the second project, how do i resolve that?
Kalai arasan
RE: How to use one plugins portlet in another
August 31, 2013 3:46 AM
Answer

Kalai arasan

Rank: Junior Member

Posts: 67

Join Date: January 2, 2013

Recent Posts

I used required deployment context and i can able to access portlet A's service from portlet B. But i build another one service named .VisitorAppointmentcontacts in Portlet B's service builder, follwing exception occurs
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'com.test.service.VisitorAppointmentcontactsLocalService' is defined
Please tell me how to solve this problem?
Kalai arasan
RE: How to use one plugins portlet in another
September 5, 2013 9:33 PM
Answer

Kalai arasan

Rank: Junior Member

Posts: 67

Join Date: January 2, 2013

Recent Posts

Hi! I used the finder method in Portlet A like as
public List<Applicationfulldetails> findByApplicationno(final String Applicationno) throws SystemException {
return applicationfulldetailsPersistence.findByApplicationno(Applicationno);
}
after build the service that is working fine for both portlets A and B. But when i closed the eclipse and started again that shows the following exception,
"Only a type can be imported. com.test.service.ApplicationfulldetailsLocalServiceUtil resolves to a package" Please tell me where is the mistake occured?