Starting from here I assume you have a working Glassfish and a working database (Mysql looks good).

Start Glassfish (asadmin start-domain domain1) and wait for it to be fully launched.

Once fully started, make sure that your database engine is also started and that you have proper rights to connect to it from your Glassfish server. I suggest the creation of lportal user on your databse server. We will come back later on this point.

There are several things that have to be configured on Glassfish in order to support Liferay:

  1. Memory
  2. Server classpath
  3. JASS (realm)
  4. Databse connection
Memory:
Liferay is requesting quite a lot of memory. Just make sure your server has enough to support it.

  • Connect to the admin interface of your Glassfish server (localhost:4848)
  • Move to Application Server > JVM Setting > JVM Options and check the global amount of memory allocated to your instance of Glassfish (should be something like -Xmx512m or more) and add one JVM Option with value: -XX:MaxPermSize=256m
  • -XX:MaxPermSize=256m is quite important. If you forget it then you are just going to crash your server when starting installing Liferay.
  • You should have something like:
Server Classpath:
In order to be able to use JAAS properly you have to add ${com.sun.aas.installRoot}/lib/liferay-portal-jaas-4.0.0.jar to path setting (Application Server > JVM Setting > Path Settings; Classpath Suffix)

JASS (Security and Realm):
Since Liferay relies on JAAS you need to create a realm in order to get access to the administrative part of it.
This is quite easy and if you pay attention to what you are doing it will spare you a lot of time.
Make sure at this point that liferay-portal-jaas-4.0.0.jar is in proper directory and that you have properly modified login.conf (in you domain config dir).

Just come back to Glassfish admin interface and go to Configuration > Secrutiry > Realms and create a new realm with name: PortalRealm
Then enter com.liferay.portal.security.jaas.ext.sun8.PortalRealm as the Class Name you want to use for this realm and add a property with name jaas-context and value PortalRealm

Save and move to the next step: database configuration

Database:
The first thing you have to do is to make sure that you have a running and accessible instance of Mysql (will report later for PostgreSQL). Currently I'm using MySQL 5.0 with 3.1.13 jdbc connector.
The second thing you have to do is to create and populate the lportal database (script and data are available for download at Liferay web site) Once done, grant access to the user you plan to use (in my case the user as the same name as the database: lportal).

Third: move back to Glassfish admin interface and go create a connection pool: Resources > JDBC > Connection Pools. Create a new one named LiferayPool.

I used the following paramaters for this connection pool:
  • datasource classname: com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource
  • resource type: javax.sql.ConnectionPoolDataSource
  • user: lportal
  • password: xxx
  • port: 3306
  • databaseName: lportal
  • serverName: localhost
You can play on other parameters to boost performances. Since I was interested in setting up a demo server I did no change.

Save this connection pool and test it with PING. If it is working properly move to the final step: creation of a JDBC Resource. Call it jdbc/LiferayPool and link it to the connection pool you have just created.

You should be ready to move to the next step: Setting up Liferay. While waiting for me to write this down downaload the EAR file and start reading the documentation on how to customize Liferay portal.

1 commentaires

  1. poster-boy // 4:49 AM  

    Hi Stefan

    Great Entry. Thanks. I've put together similar instructions to get the latest version of Liferay up and running on Glassfish. You can check them out here.

    http://www.greatwhiteit.com/web/guest/home/-/blogs/how-to-install-liferay-on-the-glassfish-applicaiton-server-over-ssh

    -Garry