论坛

主页 » Liferay Portal » English » 3. Development

组合视图 统一视图 树状图
讨论主题 [ 上一个 | 下一个 ]
toggle
How to use one plugins portlet in another Gurumurthy Godlaveeti 2012年4月17日 上午4:27
RE: How to use one plugins portlet in another David H Nebinger 2012年4月17日 上午7:34
RE: How to use one plugins portlet in another Gurumurthy Godlaveeti 2012年4月30日 上午5:18
RE: How to use one plugins portlet in another Muhammed Shakir 2012年6月16日 上午12:05
RE: How to use one plugins portlet in another Muhammed Shakir 2012年6月16日 上午12:06
RE: How to use one plugins portlet in another David H Nebinger 2012年6月16日 上午8:08
RE: How to use one plugins portlet in another Pietro Santoro 2012年10月30日 上午11:09
RE: How to use one plugins portlet in another David H Nebinger 2012年10月30日 下午12:17
RE: How to use one plugins portlet in another Rishi Dev Gupta 2012年10月30日 下午9:53
RE: How to use one plugins portlet in another Rishi Dev Gupta 2012年10月30日 下午11:14
RE: How to use one plugins portlet in another David H Nebinger 2012年10月31日 上午5:43
RE: How to use one plugins portlet in another Meera Prince 2013年2月12日 下午8:44
RE: How to use one plugins portlet in another Siby Mathew 2013年2月13日 上午5:13
RE: How to use one plugins portlet in another Meera Prince 2013年2月13日 上午5:20
RE: How to use one plugins portlet in another David H Nebinger 2013年2月13日 上午5:28
RE: How to use one plugins portlet in another Meera Prince 2013年2月13日 上午5:37
RE: How to use one plugins portlet in another Siby Mathew 2013年2月13日 上午5:32
RE: How to use one plugins portlet in another Meera Prince 2013年2月13日 上午5:39
RE: How to use one plugins portlet in another Siby Mathew 2013年2月13日 上午5:46
RE: How to use one plugins portlet in another Meera Prince 2013年2月13日 上午5:54
RE: How to use one plugins portlet in another Kalai Arasan 2013年8月31日 上午3:46
RE: How to use one plugins portlet in another Kalai Arasan 2013年9月5日 下午9:33
RE: How to use one plugins portlet in another Kalai Arasan 2014年5月7日 上午12:36
RE: How to use one plugins portlet in another Jitendra Rajput 2014年5月7日 上午1:51
RE: How to use one plugins portlet in another Kalai Arasan 2014年5月9日 上午12:01
RE: How to use one plugins portlet in another Kalai Arasan 2013年7月26日 上午1:23
RE: How to use one plugins portlet in another David H Nebinger 2013年7月26日 上午5:20
RE: How to use one plugins portlet in another Kalai Arasan 2013年7月28日 下午9:53
RE: How to use one plugins portlet in another David H Nebinger 2013年7月29日 上午5:26
RE: How to use one plugins portlet in another Kalai Arasan 2013年7月30日 下午9:17
RE: How to use one plugins portlet in another David H Nebinger 2013年7月31日 上午6:12
RE: How to use one plugins portlet in another Kalai Arasan 2013年8月26日 上午1:16
RE: How to use one plugins portlet in another Meera Prince 2014年5月9日 上午3:08
Gurumurthy Godlaveeti
How to use one plugins portlet in another
2012年4月17日 上午4:27
答复

Gurumurthy Godlaveeti

等级: Regular Member

帖子: 209

加入日期: 2011年8月11日

最近的帖子

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
2012年4月17日 上午7:34
答复

David H Nebinger

Community Moderator

等级: Liferay Legend

帖子: 11492

加入日期: 2006年9月1日

最近的帖子

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
2012年4月30日 上午5:18
答复

Gurumurthy Godlaveeti

等级: Regular Member

帖子: 209

加入日期: 2011年8月11日

最近的帖子

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
2012年6月16日 上午12:05
答复

Muhammed Shakir

等级: Junior Member

帖子: 36

加入日期: 2009年2月25日

最近的帖子

Hi David,

Have you tried this your self ?
Muhammed Shakir
RE: How to use one plugins portlet in another
2012年6月16日 上午12:06
答复

Muhammed Shakir

等级: Junior Member

帖子: 36

加入日期: 2009年2月25日

最近的帖子

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
2012年6月16日 上午8:08
答复

David H Nebinger

Community Moderator

等级: Liferay Legend

帖子: 11492

加入日期: 2006年9月1日

最近的帖子

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
2012年10月30日 上午11:09
答复

Pietro Santoro

等级: New Member

帖子: 16

加入日期: 2008年5月4日

最近的帖子

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
2012年10月30日 下午12:17
答复

David H Nebinger

Community Moderator

等级: Liferay Legend

帖子: 11492

加入日期: 2006年9月1日

最近的帖子

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
2012年10月30日 下午9:53
答复

Rishi Dev Gupta

等级: Expert

帖子: 255

加入日期: 2008年11月23日

最近的帖子

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
2012年10月30日 下午11:14
答复

Rishi Dev Gupta

等级: Expert

帖子: 255

加入日期: 2008年11月23日

最近的帖子

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
2012年10月31日 上午5:43
答复

David H Nebinger

Community Moderator

等级: Liferay Legend

帖子: 11492

加入日期: 2006年9月1日

最近的帖子

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
2013年2月12日 下午8:44
答复

Meera Prince

等级: Liferay Legend

帖子: 1110

加入日期: 2011年2月8日

最近的帖子

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
2013年2月13日 上午5:13
答复

Siby Mathew

等级: Expert

帖子: 267

加入日期: 2011年3月4日

最近的帖子

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
2013年2月13日 上午5:20
答复

Meera Prince

等级: Liferay Legend

帖子: 1110

加入日期: 2011年2月8日

最近的帖子

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
2013年2月13日 上午5:28
答复

David H Nebinger

Community Moderator

等级: Liferay Legend

帖子: 11492

加入日期: 2006年9月1日

最近的帖子

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
2013年2月13日 上午5:32
答复

Siby Mathew

等级: Expert

帖子: 267

加入日期: 2011年3月4日

最近的帖子

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
2013年2月13日 上午5:37
答复

Meera Prince

等级: Liferay Legend

帖子: 1110

加入日期: 2011年2月8日

最近的帖子

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
2013年2月13日 上午5:39
答复

Meera Prince

等级: Liferay Legend

帖子: 1110

加入日期: 2011年2月8日

最近的帖子

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
2013年2月13日 上午5:46
答复

Siby Mathew

等级: Expert

帖子: 267

加入日期: 2011年3月4日

最近的帖子

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
2013年2月13日 上午5:54
答复

Meera Prince

等级: Liferay Legend

帖子: 1110

加入日期: 2011年2月8日

最近的帖子

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
2013年7月26日 上午1:23
答复

Kalai Arasan

等级: Regular Member

帖子: 103

加入日期: 2013年1月2日

最近的帖子

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
2013年7月26日 上午5:20
答复

David H Nebinger

Community Moderator

等级: Liferay Legend

帖子: 11492

加入日期: 2006年9月1日

最近的帖子

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
2013年7月28日 下午9:53
答复

Kalai Arasan

等级: Regular Member

帖子: 103

加入日期: 2013年1月2日

最近的帖子

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
2013年7月29日 上午5:26
答复

David H Nebinger

Community Moderator

等级: Liferay Legend

帖子: 11492

加入日期: 2006年9月1日

最近的帖子

findByApplicationno() implementation should use the custom finder, not call the Util class...
Kalai Arasan
RE: How to use one plugins portlet in another
2013年7月30日 下午9:17
答复

Kalai Arasan

等级: Regular Member

帖子: 103

加入日期: 2013年1月2日

最近的帖子

Ok i understand. But how can i access the util class?
David H Nebinger
RE: How to use one plugins portlet in another
2013年7月31日 上午6:12
答复

David H Nebinger

Community Moderator

等级: Liferay Legend

帖子: 11492

加入日期: 2006年9月1日

最近的帖子

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
2013年8月26日 上午1:16
答复

Kalai Arasan

等级: Regular Member

帖子: 103

加入日期: 2013年1月2日

最近的帖子

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
2013年8月31日 上午3:46
答复

Kalai Arasan

等级: Regular Member

帖子: 103

加入日期: 2013年1月2日

最近的帖子

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
2013年9月5日 下午9:33
答复

Kalai Arasan

等级: Regular Member

帖子: 103

加入日期: 2013年1月2日

最近的帖子

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?
Kalai Arasan
RE: How to use one plugins portlet in another
2014年5月7日 上午12:36
答复

Kalai Arasan

等级: Regular Member

帖子: 103

加入日期: 2013年1月2日

最近的帖子

Hi!
I access the project A from Project B by required deployment context.But i want to forward the jsp from project A to project B!
If you know how redirect the jsp page from Project A to Project B, please tell me!
Jitendra Rajput
RE: How to use one plugins portlet in another
2014年5月7日 上午1:51
答复

Jitendra Rajput

等级: Liferay Master

帖子: 858

加入日期: 2011年1月7日

最近的帖子

You can user PortletFactoryUtil to create a URL.

PortletURL portletURL = PortletURLFactoryUtil.create(httpRequest ,portletId, plid ,PortletRequest.RENDER_PHASE);
Kalai Arasan
RE: How to use one plugins portlet in another
2014年5月9日 上午12:01
答复

Kalai Arasan

等级: Regular Member

帖子: 103

加入日期: 2013年1月2日

最近的帖子

Thanks Mr.Jitendra Rajput for your valuable reply!
Meera Prince
RE: How to use one plugins portlet in another
2014年5月9日 上午3:08
答复

Meera Prince

等级: Liferay Legend

帖子: 1110

加入日期: 2011年2月8日

最近的帖子

Hi
when we work with sharing service layer we need to have more attention.
When we update portlet services then we need to remove old jar file in lib/ext and replace with new one..

some times service might not updates such scenarios we may get these problems.. so need to clean and redeploy at the same time we need to make sure service jar file should be updated one in global lib i.e. lib/ext

when we place jar file in global lib then server should be stop.

Have look into following post it give some information ...

http://www.liferaysavvy.com/2013/12/sharing-liferay-service-layer-between.html

Regards,
Meera Prince