Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
OSGi and Portlets (preferably JSF)
Hello,
my company wants to make use of OSGi in out portlets and I'm doing the research for that, but I can hardly find any information on how to get started with it all.
I would appreciate it if someone could point me in the right direction.
Regards
my company wants to make use of OSGi in out portlets and I'm doing the research for that, but I can hardly find any information on how to get started with it all.
I would appreciate it if someone could point me in the right direction.
Regards
Right now OSGI is being improved a lot for 7.0 release, although you can do some OSGI for 6.2 too.
Please read these links:
https://www.liferay.com/web/raymond.auge/blog/-/blogs/liferay-osgi-and-shell-access-via-gogo-shell
https://www.liferay.com/es/community/forums/-/message_boards/message/37124614
Thread with a link to sample code: https://www.liferay.com/es/community/forums/-/message_boards/message/36619471
For Liferay 7.0: https://www.liferay.com/web/raymond.auge/blog/-/blogs/places-to-hook-into-liferay-from-osgi
Please read these links:
https://www.liferay.com/web/raymond.auge/blog/-/blogs/liferay-osgi-and-shell-access-via-gogo-shell
https://www.liferay.com/es/community/forums/-/message_boards/message/37124614
Thread with a link to sample code: https://www.liferay.com/es/community/forums/-/message_boards/message/36619471
For Liferay 7.0: https://www.liferay.com/web/raymond.auge/blog/-/blogs/places-to-hook-into-liferay-from-osgi
Maybe I'm just blind, but I can't find an example portlet using OSGi ... ?
So no one can help me out on this subject?
I tried to deploy the sample-metrics-portlet in tomcat (sample-metrics-core-shared was installed in the OSGi framework), but it didn't work (_metricsProdiver is always null). Couldn't find any other portlet that tries to work with OSGi.
Additionally there seems to be an error with the sample-metrics-portlet, as it floods my console again and again with stuff like "portlet ready to use" etc.
I tried to deploy the sample-metrics-portlet in tomcat (sample-metrics-core-shared was installed in the OSGi framework), but it didn't work (_metricsProdiver is always null). Couldn't find any other portlet that tries to work with OSGi.
Additionally there seems to be an error with the sample-metrics-portlet, as it floods my console again and again with stuff like "portlet ready to use" etc.
Our portlet support is very experimental in 6.2, and as you've probably noticed, not documented.
I would try to figure out what is missing from your env to make it work. Gogo shell has good tools to help with that. You need to have all the right bits deployed, resolved and active in order for it to work.
I would try to figure out what is missing from your env to make it work. Gogo shell has good tools to help with that. You need to have all the right bits deployed, resolved and active in order for it to work.
Hey,
thanks for the reply. I understand that it is experimental, but as I understood it until now, it should be possible to have a service in the framework and access it from a portlet.
I don't think my problem is on the OSGi part, in the gogo shell I have several bundles up and running that are publishing services one way or the other. My main problem ist, how to access these services from the portlet.
Maybe you can find the time to answer some questions:
1) Is my approach correct that I'm still deploying a "normal" portlet, except it has more information in the META-INF/MANIFEST.MF or do I deploy the portlet in the framework?
I tried deploying a portlet directly in the framework, but then I couldn't find it in the "Add to page"-Dialog.
2) Is there a Utility class to get a service (com.liferay.portal.kernel.util.ServiceLoader ? => returns 0 services, com.liferay.portal.kernel.bean.PortalBeanLocatorUtil ? => returns null)
3) Do I need to use the "FreemarkerPortlet" or is it already possible to use normal JSF-Portlets?
Again, I understand that in the future there will be docs etc, but we want to start a new version of our product soon and want to use Liferay and hopefully OSGi for modularity.
Thanks in advance!
thanks for the reply. I understand that it is experimental, but as I understood it until now, it should be possible to have a service in the framework and access it from a portlet.
I don't think my problem is on the OSGi part, in the gogo shell I have several bundles up and running that are publishing services one way or the other. My main problem ist, how to access these services from the portlet.
Maybe you can find the time to answer some questions:
1) Is my approach correct that I'm still deploying a "normal" portlet, except it has more information in the META-INF/MANIFEST.MF or do I deploy the portlet in the framework?
I tried deploying a portlet directly in the framework, but then I couldn't find it in the "Add to page"-Dialog.
2) Is there a Utility class to get a service (com.liferay.portal.kernel.util.ServiceLoader ? => returns 0 services, com.liferay.portal.kernel.bean.PortalBeanLocatorUtil ? => returns null)
3) Do I need to use the "FreemarkerPortlet" or is it already possible to use normal JSF-Portlets?
Again, I understand that in the future there will be docs etc, but we want to start a new version of our product soon and want to use Liferay and hopefully OSGi for modularity.
Thanks in advance!
Well maybe someone can at least answer the following:
I have the sample-metrics-portlet deployed in my OSGi-framework, but it requires "com.liferay.httpservice.servlet". No problemo, i simply add the http-service-shared bundle. But this bundle needs the "com.liferay.portal.apache.bridges.struts" service. I could only find the implementation of this service in the portal-impl.jar residing in tomcats ROOT/WEB-INF/lib/. Tried to deploy this jar in the framework but I noticed two things. First the portal-impl.jar doesn't export the bridges.struts service, secondly it has quite a lot of it's own dependencies which seem hard to fullfill as I couldn't find any of them as OSGi-read jars (don't know if I can simply add the MANIFEST.MF entries to fullfill the requirements ...)
So my question is, how do I satisfy the "com.liferay.portal.apache.bridges.struts" dependency?
If it is through the portal-impl.jar, do I "simply" add all the required "Export-package" entries that are missing in the jars required by portal-impl?
I have the sample-metrics-portlet deployed in my OSGi-framework, but it requires "com.liferay.httpservice.servlet". No problemo, i simply add the http-service-shared bundle. But this bundle needs the "com.liferay.portal.apache.bridges.struts" service. I could only find the implementation of this service in the portal-impl.jar residing in tomcats ROOT/WEB-INF/lib/. Tried to deploy this jar in the framework but I noticed two things. First the portal-impl.jar doesn't export the bridges.struts service, secondly it has quite a lot of it's own dependencies which seem hard to fullfill as I couldn't find any of them as OSGi-read jars (don't know if I can simply add the MANIFEST.MF entries to fullfill the requirements ...)
So my question is, how do I satisfy the "com.liferay.portal.apache.bridges.struts" dependency?
If it is through the portal-impl.jar, do I "simply" add all the required "Export-package" entries that are missing in the jars required by portal-impl?
Is really noone interested in using OSGi with portlets? Or is just noone sharing his/her knowledge?