Please refer to the following link for some documentation on portals and portlets development.

Liferay in Tomcat

Follow the installation instructions and use the FAQs.

Installation

Download the following files from sourceforge for version 4.3.5

  • liferay-portal.war to be put in the webapps directory
  • liferay-portal.dependencies.zip to be expanded in common/lib

Required jars

I had to copy the following jars in common/lib

  • jms.jar
  • mail.jar
  • jta.jar
  • xercesImpl.jar

Configuration

  • rename liferay-portal directory to Portal

Db Connection

  • create default database connection jdbc/LiferayPool in conf/Catalina/localhost/Portal.xml

Properties

  • Create the file WEB-INF/classes/portal-ext.properties with the following content:
    dl.root.dir=../documentlibrary/root/
    dl.version.root.dir=../documentlibrary/vroot/
    jcr.jackrabbit.repository.root=../liferay/jackrabbit
    auto.deploy.deploy.dir=../webapps
    lucene.dir=../liferay/lucene/
    portal.ctx=/Portal
    cas.auth.enabled=true
    
    terms.of.use.required=false
    
    
    #
    # Set the default values for the required CAS URLs.
    #
    cas.login.url=https://glast-ground.slac.stanford.edu/cas/login
    cas.logout.url=https://glast-ground.slac.stanford.edu/cas/logout
    cas.service.url=http://glast-ground.slac.stanford.edu/Portal/c/portal/login
    cas.validate.url=https://glast-ground.slac.stanford.edu/cas/proxyValidate
    

Force Login

To force the login edit webapps/Portal/index.jsp and replace:

<body onload="javascript:location.replace('<%= PortalUtil.getPathMain() %>')">

with

<body onLoad="javascript:location.replace('/Portal/c/portal/login')">

CAS Integration

To use the Single-Sign-On CAS server we are using the all the other applications Liferay must be integrated with it. Instructions can be found here.

The following are the steps I followed:

  • add the following line to WEB-INF/classes/portal-ext.properties
    auto.login.hooks=com.liferay.portal.security.auth.BasicAutoLogin,com.liferay.portal.security.auth.CASAutoLogin
    
  • to prevent the user being asked to change the password on the first login add the following line to WEB-INF/classes/portal-ext.properties
    passwords.change.on.first.use=false
    

Liferay 4.2.1 is deployed in an external Tomcat server 5.5.17 running with Java 1.6 and can be viewed here.

Liferay provides a distribution with a bundled tomcat server that works out of the box very easily.

Despite the fact that Liferay provides a detailed documentation on how to run the portal in an external tomcat server, it took several hours to make this happen. The following is a list of things that were not clear of that needed to be changed:

  • Liferay comes in two flavors: Professional and Enterprise editions. The Professional version is based on POJO and makes use of the Spring framework while the Enterprise edition is based on Java Enterprise Beans. As I try to avoid Spring like a disease I tried to install the Enterprise edition that can only be deployed in J2EE complient containers..... and Tomcat is not one of them. So due to my ignorance I lost a bunch of time on this. We are then using the Professional edition.
  • Liferay needs a database at the back-end. The following setup script is for Oracle. When ran it gives a handfull of errors that, so far, don't seem to compromise the functionality of the portal.
  • Had to follow the setup instructions for Mailer, JAAS but am not sure if we will need them.
  • Move webapps/ROOT/WEB-INF/lib/mail.jar to common/lib/mail.jar
  • Move webapps/ROOT/WEB-INF/lib/xercesImpl.jar to common/lib
  • Had to change the current configuration we are using for tomcat. Under tomcat/BASE/servername/ we have symbolic links for temp, logs and work to /u1/tmp/tomcat55/. The relative paths specified in the properties file above are with respect to temp that takes them somewhere unespected. In order for the Hot deploy to work I had to make temp a real directory.
  • So far the portal is running as ROOT i.e. at the base of the server ***.slac.stanford.edu:8080/ .

Startup Options

The following options have been added to the tomcat startup script:

-Dfile.encoding=UTF8 -Djava.security.auth.login.config=${CATALINA_BASE}/conf/jaas.config

Database Connection Definition

IMPORTANT all database connections must be defined within liferay Portal. This is done by adding them to conf/Catalina/localhost.ROOT.xml rather than conf/server.xml

Auto Deploy

VERY STRANGE Under the Admin portlet there should be an Auto Deploy tab that allows to deploy portlets. The test user has such tab. In order to have such tab for any other user add a similar line to WEB-INF/classes/portal-ext.properties:

omniadmin.users=turri
omniadmin.users=tonyj

Could not find anything in the database that could explain this strangeness.

User Pool

Liferay needs its own pool of users to keep track of layouts and preferences. So far I have not managed to use an external pool of users.
I managed to add users to liferay's pool by simple sql statements without having to restart liferay. If we adopt this strategy we will have to keep the liferay pool of users synchronized with the group manager's one.

Portlet Development

Following the instructions on how to setup the netbeans portlet development plugin is as accurate as tedious.
Beside the netbeans plugin itself you have to install:

  • Glassfish, the Sun J2EE Application Server(equivalent of Tomcat)
  • Enterprise Class Portlet Container Open Source Project, Sun's portal (equivalent of Liferay)

The Netbeans plugin is all you need. It allows to create netbean projects that are complient with the portlet specifications (the skeleton).
The addition of Glassfish and of Enterprise Class Portlet Container allows to nicely deploy the generated potlets within netbeans with just one click. Cute but not really necessary (maybe for developing code).

The good news is that the above generated projects can be deployed in Liveray using their Hot Deploy under the Admin tools.

JSP works but not that well. Links, Forms, everything has to be written according to "portlets" specifications, using portlet tags in order to be well integrated into the portal.

Glast Portlet Skeleton

Check-out from the glast CVS repository the project org-glast-portlet. It contains a zip file with a minimal portlet maven project called GlastPortlet. After extracting the content of the zip file you will have to make the following changes:

  • rename the root folder org-glast-portlet to reflect the name of your project
  • modify the following files to reflect your project's specifications
    • project.xml
    • project.properties
  • modify the name and package of the java class src/java/org/glast/portlet/GlastPortlet.java
  • modify WEB-INF/porlet.xml to reflect the changes to the above java class and the name of your project
  • modify the path attribute in META-INF/context.xml to reflect the name of your project
  • modify WEB-INF/liferay-portlet.xml to reflect the name of your project

You are now ready to start editing the provided jsp files and add some more.

Deployment

So far it is only possible to deploy portlets via the Hot Deploy Administrator feature of Liferay. You will have to be granted priviledges to do so.

Tables with Displatag

To have Displaytag tables well integrated in the portlet it is necessary to install their portlet extention as documented here. The displaytag-portlet.jar file can be downloaded from the glast-ground maven repository:

        <dependency>
            <groupId>displaytag</groupId>
            <artifactId>displaytag-portlet</artifactId>
            <version>1.1</version>
            <type>jar</type>
            <properties>
                <war.bundle>true</war.bundle>
            </properties>
        </dependency>

As a dependency it requires commons-collections version 3.1

  • No labels