We are trying to use the services of a portlet (Portlet A) in another portlet (Portlet B). We have put 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 packages.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?
As Lucky Boy comments, one option is to have your *-service.jar files in the global classpath, tomcat/lib/ext
Another option is to explicitly name dependencies: Edit your plugin's WEB-INF/liferay-plugin-package.properties
and add a dependency to another plugin that you need for this plugin:
required-deployment-contexts=my-other-portlet,my-custom-hook
This will make sure that the plugin containing this declaration will only deploy once the dependencies are already deployed, and it will also copy their service-jars into "itself" - e.g. my-other-portlet-service.jar
and my-custom-hook-service.jar
will automatically end up in your own webapplication, ready for use.