Revisiting Portals with Liferay 5.1

I started using portals back BDB (before .bomb) with Plumtree and Epicentric portal platforms. I always believed that these tools had tremendous potential and I still do (a mashup is just a reworked portal, right?). Portal platforms showed a lot of promise, but were caught in the hype and hysteria that swept thru many enterprise organizations as they tried to be “cool” and “hip” to the whole new internet “thing”. The result was a lot of fancy traditional websites running on top of all this software machinery they didn’t really need. Costs exploded, support was a nightmare, and users were not very happy.

In the end portal failed and most of the technology companies were eventually swallowed up or went bust. Enterprise hype also moved on (hey the authors a Computerworld and eWeek gotta make a living too, right?). Portal platforms have stuck around and have developed into robust and flexible platforms for application development. Standards have also stabilized around gadgets, XML/SOA, and AJAX.  One platform in particular has emerged and taken a dominant position in the Java/J2EE world: LifeRay Portal.

LifeRay portal (LRP) is an open-source portal platform in its 5th generation. It is a Java based solution that runs as a servlet(s) and set of J2EE based technologies on top of common application server platforms (JBoss, Websphere, Weblogic) in combination with a variety of servelet engines (Tomcat, Jetty, etc. ). LRP has a wide variety of interesting capabilities, but I’m not talking about all these here. They’ve got a decent website for that. What I’ll talk about here is my experience on setting up this tool, getting a development environment working, and my thoughts on gadgets development, and the use of application frameworks like Spring and Seam.

A bit about my configuration:

  • Windows XP Pro
  • MySQL 5.0.5
  • JBoss 4.2.2 + Jetty
  • Java 1.6
  • Eclipse 3.4 (Gannymeade)

Version 5.1 of LRP was released in the early summer of 2008 so we are right on the cutting edge. I first attempted to install LRP on top of my existing JBoss server, but I quickly ran into issue with a lack of documentation on getting this to work. I gave up and grabbed the JBoss-Jetty bundle and installed this. I already had a MySQL database on my machine. I just created a database, user accounts, and updated the liferay-ds.xml file as described in the documentation. In about 15 minutes I had LRP up and running. Not too bad.

Logging into the system was pretty easy – you can create accounts with the default setup. The admin account is “test@liferay.com” and the password is “test” – that was a bit tricky to figure out. Once you’re logged in you will get the default pages and you can navigate around to other views and functions. I was not able to find a pre-built “admin” page, but no worries. I created a new page and the added widgets to the page for the admin stuff I wanted to do first. The page layouts and themes are very nice. LRP was first famous for its AJAX drag and drop interface. It is definitely impressive and allows you to move gadgets around on the screen as you like.

Now that I’ve got the basic system up and running I want to start looking at building themes and portlets (what LRP calls “plugins”). There are a couple of development docs that LRP has:

  • Developing for the “core” with the “EXT”
  • Developing plugins with the Plusgin SDK

I started off looking into the EXT, but the docs aren’t ready yet for 5.1 and it was looking grim. I read thru a bunch of docs and decided I really didn’t need that anyway since all I want to do is create some portal gadgets and screw with themes for now. So if you’re following along, grab the plugin SDK and install that thing. There’s a decent PDF “LifeRay 4.3 Plugins Guide” to get you going. Unfortunately it does not describe how to get Eclipse setup up right so I straight away barked my shins on that bump.

There’s a little utility you can run to generate a portlet project. I did that and created a new eclipse project from sources (J2EE type) and then I could see the code and stuff. The next problem is how to get the tag libraries and other build stuff configured properly. What you need to do is find the right jars and tld files and either manually copy these over to your gadget or figure out how to get eclipse to realize where these are and add them to your classpath.

I gave up on the latter and simply copied everything over – create a tld folder file in your WEB-INF folder of your portlet and copy all the files into there from the main tld folder (even though you probably won’t need them all). Then you will need to add the tags to your WEB-INF (even tho this is supposedly not required in the servelet 2.4 spec apparently eclipse needs it still to find the libraries). I went to the main web.xml for the portal itself and cut paste the right stuff over into mine. Just add the ones you need to use to web.xml. Use a reference like this:

<jsp-config>
<taglib>
<taglib-uri>http://java.sun.com/portlet</taglib-uri>
<taglib-location>/WEB-INF/tld/liferay-portlet.tld</taglib-location>
</taglib>
</jsp-config>

That has to go into the web-app tag.

Then in your jsp code include this with a line like this:

<%@ taglib uri=”http://java.sun.com/portlet” prefix=”portlet” %>

With all that done now we’re ready to code!

But we’ll have to save that for next time…another post in a couple of days.

1 Comment

  1. Pingback: Liferay…I need a Life Jacket; Giving JBoss Portal a Try. « Tarn Aeluin

Leave a Reply