Liferay

LifeRay , a portal implemented using Spring.

Attempting to deploy Liferay Portlets in uPortal

I've been looking at the Liferay portlets and here's what I've come up with.

All of their portlets are essentially bundled in one large portal-ejb.jar file. I extracted that file into a directory to try and pull out just one or two portlets and try to deploy them in uPortal.

First, the portlet.xml file contains the portlet definitions for all of the portlets but I could extract the appropriate fragment out (and the fragment out the web.xml files) to attempt to create a single Portlet.

Looking at the portlet fragment I found a few interesting items.

The portlet-name value for each portlet is set to a numeric value rather than something more descriptive like ChatPortlet. Presumably the framework maps the numbers to a descriptive name somewhere for publication.

Next, the portlet-class for almost all of the portlets is either com.liferay.portlet.StrutsPortlet or com.liferay.portlet.JSPPportlet. The portlet definition also contains a resource bundle called com.liferay.portlet.StrutsResourceBundle. As it turns out, the portal-ejb.jar file (deployed on the TOMCAT_HOME/common/lib/ext directory in a Liferay install) contains all of these classes.

I created a build directory with a build.xml file in it and extracted the classes from the jar file and also copied the jsp files for the new into a web directory. I had to made some simple mods to the portlet.xml and web.xml files but once I did I was able to build a war file. For my experiment I grabbed the content from the ChatPortlet. It used the JSPPortlet class so I figured if I got that one to work a lot of other portlets could be migrated.

Once I built the war file I was able to deploy it using the uPortal deployPortletApp task, and according to the tomcat logs it (eventually) deployed without any errors.

I was then able to publish the portlet using the admin interface and subscribe to the portlet.

HOWEVER, when it attempted to render I got a ClassCastException from com.liferay.portlet.JSPPortlet. I ended up downloading the liferay source distribution and looked at the code for JSPPortlet. It extended a LiferayPortlet class which in turn extended GenericPortlet. At first I thought that maybe the different version of the portlet api jar files was causing the problem and set about recompiliing the JSPPortlet and LiferayPortlet classes using the same portlet api jar file that uPortal uses. I then discovered that the LiferayPortlet had some includes from a org.liferay.portal.utils packages that seems to be part of the core framework.

Even when I did get all of the classes recompiled I still got the ClassCastException.

At that point I gave up.

What I liked about Liferay

  • communities - There is a select list at the top of the page which allows the user to select from one or more communities. It works essentially like multiple guest layouts providing different views of the portal depending on which community they select.
  • Rather than a sitemap portlet which sits atop the page like we've got, they offer a navigation channel. It provides a collapsable folder hierarchy with links to all of the portlets (or pages) available within the community.
  • undecorated portlets - the user interface allows the end user to render a portlet without the "frame" decoration. It was nice to be able to place a navigation portlet on the left side of the page without the borders. It made the portal look less boxy.