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 https://lportal.svn.sourceforge.net/svnroot/lportal/portal/branches/4.3.x/ 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 https://glassfish.dev.java.net/public/alldownloads.html#GlassFish_v2_1_branch 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 app.server.USERNAME.properties (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
##

app.server.glassfish.dir=${app.server.parent.dir}/glassfish
app.server.glassfish.bin.dir=${app.server.glassfish.dir}/bin
app.server.glassfish.classes.global.dir=${app.server.glassfish.dir}/domains/domain1/lib/classes
app.server.glassfish.classes.portal.dir=${app.server.glassfish.portal.dir}/WEB-INF/classes
app.server.glassfish.deploy.dir=${app.server.glassfish.dir}/domains/domain1/autodeploy
app.server.glassfish.lib.global.dir=${app.server.glassfish.dir}/domains/domain1/lib
app.server.glassfish.lib.portal.dir=${app.server.glassfish.portal.dir}/WEB-INF/lib
app.server.glassfish.portal.dir=${app.server.glassfish.deploy.dir}/liferay-portal.war
app.server.glassfish.log.dir=${app.server.glassfish.dir}/domains/domain1/logs
app.server.glassfish.temp.dir=${app.server.glassfish.dir}/domains/domain1/logs
app.server.glassfish.work.dir=${app.server.glassfish.dir}/domains/domain1/logs
app.server.glassfish.zip.name=glassfish-installer-v2.1-b12-darwin.jar
app.server.glassfish.zip.url=http://java.net/download/javaee5/promoted/WINNT/${app.server.glassfish.zip.name}


4.2 Create build.USERNAME.properties if you are not using Jikes and make the following changes:

##
## Compiler
##

javac.compiler=modern
javac.debug=on
javac.deprecation=off
javac.fork=true
javac.memoryMaximumSize=256m
javac.nowarn=on

4.3 Create release.USERNAME.properties 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 test@liferay.com 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,
-Dcom.sun.enterprise.server.ss.ASQuickStartup=false (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,

    Marisol