掲示板

Using sevices of a portlet in another

thumbnail
10年前 に Varsha . によって更新されました。

Using sevices of a portlet in another

Regular Member 投稿: 187 参加年月日: 12/03/05 最新の投稿
Dear All,

We are trying to use the services of a portlet(Portlet A) in another portlet(Portlet B ). We had putted the jar file of the services(Portlet A) in \tomcat-7.0.27\webapps\ROOT\WEB-INF\lib and included this jar in display plugin pakages.xml of another portlet(Portlet B ).

We are using external database ie we had made the changes in portlet-spring.xml .

If i deploy the portlet that contains actual services(Portlet A) and call some method of services then it is called fine & it fetches the data ,If we write the same method in the another portlet (Portlet B )then it fetches the data.
But the problem occur when we try to write a method in another portlet(Portlet B ) that has not been called in the actual service portlet(Portlet A ), then the data is not fetched. It always bring a blank.

Can any one suggest what could be the reason.

We cant put up all of the portlets in the same jar as no of portlets are very large.(approx 35).

Or is there any other better solution rather than putting up the jar file in the lib directory?
thumbnail
10年前 に Aritz Galdos によって更新されました。

RE: Using sevices of a portlet in another

Expert 投稿: 416 参加年月日: 07/05/15 最新の投稿
Hi

Try to put the JAR in tomcat-7.0.27/lib instead.

And remember that the jar MUST NOT BE in Porltet B' lib folder. If necessary, stop tomcat, and delete the duplicated jar manually. Then restart. Now Porltet A should be able to use Portlet B's service
thumbnail
10年前 に Varsha . によって更新されました。

RE: Using sevices of a portlet in another

Regular Member 投稿: 187 参加年月日: 12/03/05 最新の投稿
I have tried the methods as stated above. But with this I am facing a problem.
I am not able to find the XXXXImpl class in Portlet B. I need to create an object like XXXX xxxx = new XXXXImpl(); .
Any suggestion on the same.
10年前 に John Carter によって更新されました。

RE: Using sevices of a portlet in another

Junior Member 投稿: 53 参加年月日: 12/10/18 最新の投稿
Hi Varsha,

Check below post to use service jar of one portlet in another portlet.
http://www.liferay.com/community/forums/-/message_boards/message/13505223
thumbnail
10年前 に David H Nebinger によって更新されました。

RE: Using sevices of a portlet in another (回答)

Liferay Legend 投稿: 14916 参加年月日: 06/09/02 最新の投稿
Varsha .:
I need to create an object like XXXX xxxx = new XXXXImpl();


No you don't, you just need to learn how to use XXXXLocalServiceUtil.createXXXX();
thumbnail
10年前 に Jignesh Vachhani によって更新されました。

RE: Using sevices of a portlet in another

Liferay Master 投稿: 803 参加年月日: 08/03/10 最新の投稿
Varsha,

Best practice is , either you access through remote web service or create all the portlets under one portlet bundle by modifying specific configuration file like portlet.xml, liferay-portlet.xml,liferay-display.xml.
So this way you can easily access all the services any portlets which are coming under one package(war file).
thumbnail
10年前 に David H Nebinger によって更新されました。

RE: Using sevices of a portlet in another

Liferay Legend 投稿: 14916 参加年月日: 06/09/02 最新の投稿
Jignesh Vachhani:
Best practice is , either you access through remote web service or create all the portlets under one portlet bundle...


Best practice for whom?

I have a team of programmers working on separate portlets. I don't want them spending their time trying to merge their separate code into a single portlet bundle...

Likewise I don't want performance to degrade in the cycle of marshalling/unmarshalling data across a remote web service call that is quite easily handled by using the XxxxLocalServiceUtil classes properly...

Normally Jignesh I tend to agree w/ things you post in the forums, but in this case I must disagree...
thumbnail
10年前 に Jignesh Vachhani によって更新されました。

RE: Using sevices of a portlet in another

Liferay Master 投稿: 803 参加年月日: 08/03/10 最新の投稿
Yeah David,

I think that needs to be taken care before we start actual development.
Instead of putting portlet service jars in tomcat lib or individual portlets doesn't seems like good practice.
So before we start actual development of portlet, we should be able to know whether we need to use service of any other portlets or not.
then we can simply integrate it with that portlet and can easily use services vice-versa.

Regards,
Jignesh
thumbnail
10年前 に David H Nebinger によって更新されました。

RE: Using sevices of a portlet in another

Liferay Legend 投稿: 14916 参加年月日: 06/09/02 最新の投稿
We use a separate portlet plugin to hold our service tier(s). These are responsible for managing the data access and housing business logic. In these we use a service-ext.properties file to fix the build.number value to a specific number (helps to avoid the service version check issues).

We create our portlets as (mostly) separate portlet plugin projects. Sometimes we'll group them when the portlets are tightly coupled, but disparate plugins are always separated.

We use the Liferay IDE to manage the copying into the project of the service jar by declaring the service as a required deployment context. The IDE will ensure that the service jar gets copied to all dependent projects when the services are rebuilt.

This setup has worked flawlessly. No moving of service jar into the global lib directory, so hot deploy works great. Portlets do not require redeploy as long as the signatures for the methods they use in the service jar haven't changed. We don't have the overhead of extra web service marshalling to worry about, and can safely ignore credentials for web service calls.

It just plain works. But to say this scenario isn't "best case" because it doesn't conform to a single project or a remote web service call is incorrect.