Installing Liferay on JBoss 5.1
Note: Java 7 deprecated some classes used by JBoss 5.1. Use Java 5 or Java 6 to run JBoss 5.1.
Liferay Home is one folder above JBoss’s install location.
Download and install JBoss EAP 5.1.x into your preferred directory. This directory is referred to as
$JBOSS_HOME throughout this section.
Download the latest version of the Liferay Portal
Download Liferay’s Portal Dependencies.
Now that you have all of your installation files, you are ready to start installing and configuring Liferay on JBoss.
First we’ll take care of dependencies and potential conflicts.
Unzip Liferay’s dependencies to
Download your database driver
.jar file and put it into the folder as well. For demonstration purposes, we’ll download the MySQL Connector/J driver from http://dev.mysql.com/downloads/connector/j/ and put its
.jar file into the
Next we’ll delete JBoss’s Hibernate Validator and HSQL JARs to prevent conflicts with Liferay’s JARs. Remove the following files from
Next we need to clean up the entries for the JAR files that we deleted.
$JBOSS_HOME/server/default/conf/login-config.xml in a text editor.
Comment out the blocks with the name
JmsXARealm around lines 41-64.
We’ll also delete some other files that can cause conflicts with Liferay when it’s deployed.
Remove the following directories and files from
Delete the following in
Now that we’ve added all of the necessary dependencies and removed unnecessary files, it’s time to deploy Liferay.
$JBOSS_HOME/server/default/deploy/ROOT.war and delete all the content of the folder.
Extract the contents of the Liferay WAR file into this folder.
Create a file named
jboss-classloading.xml in the
$JBOSS_HOME/server/default/ROOT.war/WEB-INF directory and add the following contents to it:
This configuration file defines a domain that does not allow parent classes to load first. Instead, Liferay Portal’s classes are exported. Since JBoss comes with its own Hibernate JARs, the above configuration is needed to tell Liferay to ignore these JARs and to use its own JARs instead. If you omit this configuration, you may encounter a Hibernate exception. It’s also necessary to add a
jboss-classloading.xml file to the
WEB-INF folder of each Liferay plugin; see the Deploying plugins section below.
portal-ext.properties file in
$LIFERAY_HOME (one level above
$JBOSS_HOME) and add the following properties:
Delete the following files from the
Add the following lines to your
NOTE: The autodeploy folder must be set with the full name of the folder; you can’t use any variables to define the location.
Increase the memory given to the JVM
By deafult JBoss gives 512MB memory to the JVM. With this setting it is most likely that you will face the following error at startup, runtime or shutdown:
java.lang.OutOfMemoryError: GC overhead limit exceeded
To give the JVM more memory, edit
run.conf on *nix) and change
Start the JBoss Application Server.
Liferay is now successfully installed on JBoss 5.1.
jboss-classloading.xml to the
WEB-INF folder of each plugin, with the following content:
LiferayDomain referenced in the above configuration is the domain we defined above during step 3 of the Deploying Liferay section. Configuring plugins to use the Liferay domain ensures that if JBoss and Liferay have different versions of a JAR file, the plugin will use Liferay’s version. Without this configuration, Liferay plugins might end up using the wrong versions of JAR files. You can make this configuration either before or after the plugin WAR has been deployed, as long as JBoss is not running. Of course, it’s best to make this configuration before deployment. Otherwise, if there’s a JAR conflict, you’ll have to shut down your server, configure the plugin to use the Liferay domain, and restart the server.
To set up a hot deploy folder and have plugins automatically copied to the right place, add the following lines to your
The first line is the value for the default server; if you’ve installed Liferay in something other than the default, change it accordingly. The path in the second line should point to the
deploy folder configured for JBoss.
Liferay also runs on JBoss 7. Let’s see how we’d get it installed on that version of JBoss.