Beware of Liferay on a GlassFish Application Server

If you're using Liferay to build a portal or website, I highly recommend using Liferay with bundled Tomcat.  Learn from other's headaches, it's not worth the trouble of trying to use something other than Tomcat.

Originally, we were trying to use GlassFish 3.x.x because we have a support contract.  We got our environments up and running reasonably quickly.  Our environments were the following:

  • Local Dev (Windows 7) - Tomcat7 (bundled Liferay Developer Studio), MySQL V5 DB
  • Dev (Ubuntu VM) - Liferay 6.1.2 deployed to GlassFish , MySQL V5 DB
  • Test (RHEL) - Liferay 6.1.2 deployed to GlassFish , Oracle 10G
  • QA (RHEL) - Liferay 6.1.2 deployed to GlassFish, Oracle 10G
  • Production (RHEL) - Liferay 6.1.2 deployed GlassFish, Oracle 10G

Once we started doing significant work, developing portlets and customizing Liferay (hooks, themes, ext plugin, etc...) we started running into problems.

I had difficulties migrating data between environments, which was important early in development.  While trying to migrate the database from one environment to another (Control Panel -> Server -> Administration -> Data Migration), I repeatedly got errors and the migration failed.  I determined that migrating from one environment to another never worked when using Liferay deployed to GlassFish.  The migrations always failed with a null pointer exception.  Analysing the error in the logs and a Google search didn't lead to a solution to the problem.

However, I did eventually find a workaround for migrating data between environments, but it wasn't practical due to our network configuration (Firewalls blocking traffic between certain environments).  The workaround was to connect my Local Dev environment, by temporarily modifying my portal-ext.properties file, to the source database for the data migration.  Basically I found that the version of Liferay bundled with Tomcat was the only Liferay installation able to perform the data migration successfully.

We did encounter other problems using GlassFish as well.  We put a lot of effort into clustering Liferay deployed to GlassFish without success.  After scouring the Liferay forums and discussing our options with Liferay support we decided to give up on GlassFish and use Tomcat instead.

After switching to Tomcat, we had clustering working with minimal effort and our data migration issues were solved.  In hindsight we would have saved a lot of time and effort by simply using Tomcat from the start.  It's important to note as well, that we haven't had any stability/reliability issues due to Tomcat, and have almost been live for 2 years.