Liferay 4.3.5 & Glassfish v2.1

Published by Stephane PAQUET | 11:51 AM | , | 1 commentaires »

Back online.

Well, Glasffish is full of suprise and here is a way to have your favorite portal running on Glassfish.
If you just download the bundle it will not work on Unix system. It is designed for Windows only at the presente time.

So, here is what I did in order to have liferay running on Linux (Ubuntu, OS X 10.4, Solaris 10 and OpenSolaris). things may vary a little from on OS to an other but no major change.

What you need:

  • Java JDK 1.5 (at least)
  • Subversion (could be GUi client)
  • Apache ant 1.6.5 or upper
  • MySQL (5.0.45 or upper) or PostgreSQL (8.1 or upper)
What to do from here:

1. Download from SVN latest version of Liferay (could be 4.4, but I suggest 4.3.x since this is the stable branche).
svn co lportal

(reminder for those not SVN gifted: once you have done previous operation you can update your portal source by going to your lportal directory and typing svn up)

2. during svn checkout you can download Glassfish from and install the right version for your OS according to Glassfish site.

3. Once glassfish is installed put PostgreSQL or MySQL .jar file in {glassfish.home.dir}/lib

4. Then move back to lportal directory and get ready to edit some files:

4.1 Create (under unix type whoami in Terminal in order to have you username) and edit it.
Main changes are for app.server.parent.dir, which must be defined accordingly to your glassfish home dir.

## Glassfish


4.2 Create if you are not using Jikes and make the following changes:

## Compiler


4.3 Create and edit path according to your needs

4.4 Go for a test and start compiling Liferay:
ant start
ant compile
ant deploy (will deploy required jar and war files to proper dir)

4.5 Create database in MySQL or PostgreSQL. I recommend using create-minimal-YOURDATABASEMODEL.sql in order to have a light database profile. User will be created during initial deployment of Liferay.

4.6 Make some changes in your Glassfish configuration. for that you'll have to start it and connect as Administrator (for example http://localhost:4848/)

First change: add LiferayPool in Resources/JDBC/Connection Pools select pooling mode according to your needs and your database.

Second: add jdbc/LiferayPool in Resources/JDBC/JDBC Resources and connect it to previously created pool

Third: go to Application Server/JVM Settings/JVM Options and check that you have enough memory allocated:
-XX:MaxPermSize=xxxm where xxx>= 256 ex.: -XX:MaxPermSize=256m,
-Xmxyyym where yyy>=512 ex.: -Xmx512m, (thanks to Rogue XZ for its post on liferay forum).

Then stop your glassfish instance and make some other changes such as adding Xerces jar in {glassfish.home.dir}/domains/domain1/lib

you may have to stop/restart twice your glassfish instance in order to have liferay running properly. This is a "bug" that was and seems to be still there. It is due to the fact that liferay is using / context and glassfish has some doc for that context too. So removal of Glassfish doc does not seem to occur during first startup.

Then you can go to http://localhost:8080 and enjoy a running version of Liferay on Glassfish.

Enjoy ;-)

1 commentaires

  1. Marisol // 7:00 PM  

    Hi Stef,

    I was reading your articles on how to get glassfish configured with Liferay. I have a few questions I was hoping you could help me out with.
    I'm using Liferay 4.4.2 and glassfish v2ur1. All the documentation that I've found seems to be for older versions. From your articles, "Liferay & Glassfish parts I,II,III," it says to download liferay-portal-jaas-4.0.0.jar and place it in the lib directory. Do I need to do this for my version? Should I place the liferay-portal-glassfish-windows-4.4.2.jar
    in the lib directory? If not, do I even need this bundle?
    If I don't have to use the jaas jar file, do I still have to modify login.conf file?

    I appreciate any help you can give me.

    Thanks alot,