Resolution
First Steps
Liferay Home, by default, is one folder above JBoss EAP 5.2’s install location.
- Download and install JBoss EAP 5.2 into your preferred directory. This directory is referred to as
$JBOSS_HOME
throughout this section. - Download the latest version of the Liferay Portal .war file.
- Download Liferay’s Portal Dependencies.
Configuring Dependencies
- Unzip Liferay’s dependencies to
$JBOSS_HOME/jboss-as/server/default/lib
.hsql.jar
portal-service.jar
portlet.jar
- Additionally, copy the following jars into the same folder:
activation.jar
jta.jar
mail.jar
mysql.jar
persistence.jar
postgresql.jar
script-10.jar
servlet-api.jar
- Next delete JBoss’s Hibernate Validator and HSQL JARs to prevent conflicts with Liferay’s JARs. Remove the following files from
$JBOSS_HOME/jboss-as/common/lib
:hibernate-validator.jar
hsqldb.jar
hsqldb-plugin.jar
- Open
$JBOSS_HOME/jboss-as/server/default/conf/login-config.xml
in a text editor. - Comment out the blocks with the name HsqlDBRealm and JmsXARealm around lines 41-64.
- Delete the following files that can cause conflicts with Liferay located in
$JBOSS_HOME/../server/default/deploy
:/messaging
ejb2-container-jboss-beans.xml
ejb2-timer-service.xml
ejb3-connections-jboss-beans.xml
ejb3-container-jboss-beans.xml
ejb3-interceptors-aop.xml
ejb3-timerservice-jboss-beans.xml
hsqldb-ds.xml
jms-ra.rar
mail-ra.rar
mail-service.xml
profile-service-secured.jar
uuid-key-generator.sar
- Delete the following in
$JBOSS_HOME/jboss-as/server/default/deployers
:jboss-ejb3-endpoint-deployer.jar
messaging-definitions-jboss-beans.xml
Deploying Liferay
- Navigate to
$JBOSS_HOME/jboss-as/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:<classloading xmlns="urn:jboss:classloading:1.0" parent-first="false" domain="LiferayDomain" export-all="NON_EMPTY" import-all="true"> </classloading>
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 this is omitted during configuration, there may be a Hibernate exception. It is also necessary to add a jboss-classloading.xml file to the WEB-INF folder of each Liferay plugin; see the Deploying plugins section below. - Create a
portal-ext.properties
file in$LIFERAY_HOME
(one level above $JBOSS_HOME) and add the following properties:hibernate.validator.apply_to_ddl=false hibernate.validator.autoregister_listeners=false auto.deploy.jboss.dest.dir=${jboss.home.dir}/server/default/deploy auto.deploy.deploy.dir=C:/JBoss-/deploy
- Delete the following files from the
$JBOSS_HOME/ROOT.war/WEB-INF/lib
:jaxrpc.jar
stax.jar
xercesImpl.jar
xml-apis.jar
Add a jboss-classloading.xml
to the WEB-INF folder of each plugin, with the following content:
<classloading xmlns="urn:jboss:classloading:1.0" domain="PLUGINNAME-portlet" parent-domain="LiferayDomain" parent-first="false" top-level-classloader="false" export-all="NON_EMPTY" import-all="false"> </classloading>
The LiferayDomain referenced in the above configuration is the domain 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. Make this configuration either before or after the plugin WAR has been deployed, as long as JBoss is not running. Of course, it is best to make this configuration before deployment. Otherwise, if there is a JAR conflict, shut down the server, configure the plugin to use the Liferay domain, and restart the server.
In order to start JBoss EAP 5.2. users MUST put the following configuration in the run.conf.bat:
set "JAVA_OPTS=-Dorg.jboss.net.protocol.file.useURI=false -Dfile.encoding=UTF8 -Duser.timezone=GMT"
This property handles Java memory; if not set, there will be PermGen Errors.