Installing Liferay DXP on JBoss EAP 7.1 takes three steps:
- Installing Liferay DXP dependencies to your application server
- Configuring your application server for Liferay DXP
- Installing the Liferay DXP WAR file to your application server
Before proceeding, download these files for DXP or Portal CE:
- Liferay DXP WAR file
- Dependencies ZIP file
- OSGi JARs ZIP file
Liferay DXP requires a Java JDK 8 or 11.
Liferay Home
is the folder containing your JBoss server folder. After installing and
deploying Liferay DXP, the Liferay Home folder contains the JBoss server folder as
well as data
, deploy
, logs
, and osgi
folders. $JBOSS_HOME
refers to
your JBoss server folder. This folder is usually named jboss-eap-[version]
.
Installing Dependencies
Liferay DXP depends on several Liferay-specific and third-party JARs. Download and install the required JARs as described below.
-
Create the folder
$JBOSS_HOME/modules/com/liferay/portal/main
if it doesn’t exist and extract the Liferay dependencies ZIP JARs to it. -
Download your database driver
.jar
file and copy it into the same folder. Please see the compatibility matrix for a list of supported databases. -
Create the file
module.xml
in the$JBOSS_HOME/modules/com/liferay/portal/main
folder. In the file, declare the portal module and all of its required resources and dependencies:<?xml version="1.0"?> <module xmlns="urn:jboss:module:1.0" name="com.liferay.portal"> <resources> <resource-root path="[place your database vendor's JAR file name here]" /> <resource-root path="[place a Liferay dependencies JAR file name here]" /> <!-- Add a resource-root element for each Liferay dependencies JAR --> </resources> <dependencies> <module name="javax.api" /> <module name="javax.mail.api" /> <module name="javax.servlet.api" /> <module name="javax.servlet.jsp.api" /> <module name="javax.transaction.api" /> </dependencies> </module>
Replace
[place your database vendor's JAR file name here]
with the driver JAR for your database.For each JAR in the Liferay dependencies ZIP, add a
resource-root
element with itspath
attribute set to the JAR name. For example, add aresource-root
element like this for thecom.liferay.petra.concurrent.jar
file:<resource-root path="com.liferay.petra.concurrent.jar" />
-
Create an
osgi
folder in your Liferay Home folder. Extract the OSGi ZIP file that you downloaded into theosgi
folder.The
osgi
folder provides the necessary modules for Liferay DXP’s OSGi runtime.
Checkpoint:
- The dependencies files have been unzipped into the
$JBOSS_HOME/modules/com/liferay/portal/main
folder and a database jar. - The
module.xml
contains all JARs in the<resource-root-path>
elements. - The
osgi
dependencies have been unzipped into theosgi
folder.
Running Liferay DXP on JBoss EAP in Standalone Mode vs. Domain Mode
JBoss EAP can be launched in either standalone mode or domain mode. Domain mode allows multiple application server instances to be managed from a single control point. A collection of such application servers is known as a domain. For more information on standalone mode vs. domain mode, please refer to the section on this topic in the JBoss EAP Product Documentation.
Liferay DXP supports JBoss EAP when it runs in standalone mode but not when it runs in domain mode. Liferay DXP’s hot-deploy does not work with a managed deployment, since JBoss manages the content of a managed deployment by copying files (exploded or non-exploded). This prevents JSP hooks and Ext plugins from working as intended. For example, JSP hooks don’t work on JBoss EAP running in managed domain mode, since Liferay DXP’s JSP override mechanism relies on the application server. Since both of these features are deprecated, however, you may not be using them.
The command line interface is recommended for domain mode deployments.
Configuring JBoss
Configuring JBoss to run Liferay DXP includes these things:
- Setting environment variables
- Setting properties and descriptors
- Removing unnecessary configurations
Optionally, you can configure JBoss to manage these things for Liferay DXP:
Start with configuring JBoss to run Liferay DXP.
Make the following modifications to
$JBOSS_HOME/standalone/configuration/standalone.xml
:
-
In the
<jsp-configuration>
tag, set the Java VM compatibility for Liferay source and class files. They are compatible with Java 8 by default.<jsp-configuration development="true" source-vm="1.8" target-vm="1.8" />
-
Locate the closing
</extensions>
tag. Directly beneath that tag, insert these system properties:<system-properties> <property name="org.apache.catalina.connector.URI_ENCODING" value="UTF-8" /> <property name="org.apache.catalina.connector.USE_BODY_ENCODING_FOR_QUERY_STRING" value="true" /> </system-properties>
-
Add the following
<filter-spec>
tag within the<console-handler>
tag, directly below the<level name="INFO"/>
tag:<filter-spec value="not(any(match("WFLYSRV0059"),match("WFLYEE0007")))" />
-
Add a timeout for the deployment scanner by setting
deployment-timeout="360"
as seen in the excerpt below.<subsystem xmlns="urn:jboss:domain:deployment-scanner:2.0"> <deployment-scanner deployment-timeout="360" path="deployments" relative-to="jboss.server.base.dir" scan-interval="5000"/> </subsystem>
-
Add the following JAAS security domain to the security subsystem
<security-domains>
defined in element<subsystem xmlns="urn:jboss:domain:security:2.0">
.<security-domain name="PortalRealm"> <authentication> <login-module code="com.liferay.portal.kernel.security.jaas.PortalLoginModule" flag="required" /> </authentication> </security-domain>
-
Remove the two code snippets providing welcome content:
<location name="/" handler="welcome-content"/>
and
<handlers> <file name="welcome-content" path="${jboss.home.dir}/welcome-content"/> </handlers>
-
Find the
<jsp-config/>
tag and set thedevelopment
,source-vm
, andtarget-vm
attributes in the tag. Once finished, the tag should look like this:<jsp-config development="true" source-vm="1.8" target-vm="1.8"/>
Checkpoint:
Before continuing, verify the following properties have been set in the
standalone.xml
file:
-
The new
<system-property>
is added. -
The new
<filter-spec>
is added. -
The
<deployment-timeout>
is set to360
. -
The new
<security-domain>
is created. -
Welcome content is removed.
-
The
<jsp-config>
tag contains its new attributes.
Now you should configure your JVM and startup scripts.
In the $JBOSS_HOME/bin
folder, you must make these modifications to your
standalone domain’s configuration script file standalone.conf
(standalone.conf.bat
on Windows):
- Set the file encoding to
UTF-8
- Set the user time zone to
GMT
- Set the preferred protocol stack
- Increase the default amount of memory available.
Make the following edits as applicable to your operating system:
Windows
-
Comment out the initial
JAVA_OPTS
assignment as demonstrated in the following line:rem set "JAVA_OPTS=-Xms1G -Xmx1G -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m"
-
Add the following
JAVA_OPTS
assignment one line above the:JAVA_OPTS_SET
line found at end of the file:set "JAVA_OPTS=%JAVA_OPTS% -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true -Djboss.as.management.blocking.timeout=480 -Duser.timezone=GMT -Xmx2048m -XX:MaxMetaspaceSize=384m"
Unix
-
Below the
if [ "x$JAVA_OPTS" = "x" ];
statement, replace thisJAVA_OPTS
statement:JAVA_OPTS="-Xms1303m -Xmx1303m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true
with this:
JAVA_OPTS="-Djava.net.preferIPv4Stack=true"
-
Add the following statement to the bottom of the file:
JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true -Djboss.as.management.blocking.timeout=480 -Duser.timezone=GMT -Xmx2048m -XX:MaxMetaspaceSize=512m"
Checkpoint:
At this point, you’ve finished configuring the application server’s JVM settings.
-
The file encoding, user time-zone, preferred protocol stack have been set in the
JAVA_OPTS
in thestandalone.conf.bat
file. -
The default amount of memory available has been increased.
The prescribed script modifications are now complete for your Liferay DXP installation on JBoss. Next you’ll configure the database and mail.
Database Configuration
The easiest way to handle your database configuration is to let Liferay DXP manage your data source. The Basic Configuration page lets you configure Liferay DXP’s built-in data source. If you want to use the built-in data source, skip this section.
If you want JBoss to manage your data source, follow these steps:
-
Add the data source inside the
$JBOSS_HOME/standalone/configuration/standalone.xml
file’s the<datasources>
element.<datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" jta="true" use-java-context="true" use-ccm="true"> <connection-url>[place the URL to your database here]</connection-url> <driver>[place the driver name here]</driver> <security> <user-name>[place your user name here]</user-name> <password>[place your password here]</password> </security> </datasource>
Make sure to replace the database URL, user name, and password with the appropriate values.
-
Add the driver to the
standalone.xml
file’s<drivers>
element also found within the<datasources>
element.<drivers> <driver name="[name of driver must match name above]" module="com.liferay.portal"> <driver-class>[place your JDBC driver class here]</driver-class> </driver> </drivers>
A final data source subsystem that uses MySQL should look like this:
<subsystem xmlns="urn:jboss:domain:datasources:5.0"> <datasources> <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" jta="true" use-java-context="true" use-ccm="true"> <connection-url>jdbc:mysql://localhost/lportal</connection-url> <driver>mysql</driver> <security> <user-name>root</user-name> <password>root</password> </security> </datasource> <drivers> <driver name="mysql" module="com.liferay.portal"/> </drivers> </datasources> </subsystem>
-
In a
portal-ext.properties
file in your Liferay Home, specify your data source:jdbc.default.jndi.name=java:jboss/datasources/ExampleDS
Now that you’ve configured your data source, the mail session is next.
Mail Configuration
As with database configuration, the easiest way to configure mail is to let Liferay DXP handle your mail session. If you want to use Liferay DXP’s built-in mail session, skip this section and configure the mail session in the Control Panel.
If you want to manage your mail session with JBoss, follow these steps:
-
Specify your mail subsystem in the
$WILDFLY_HOME/standalone/configuration/standalone.xml
file like this:<subsystem xmlns="urn:jboss:domain:mail:3.0"> <mail-session jndi-name="java:jboss/mail/MailSession" > <smtp-server ssl="true" outbound-socket-binding-ref="mail-smtp"> <login username="USERNAME" password="PASSWORD"/> </smtp-server> </mail-session> </subsystem> ... <socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}"> ... <outbound-socket-binding name="mail-smtp"> <remote-destination host="smtp.gmail.com" port="465"/> </outbound-socket-binding> </socket-binding-group>
-
In your
portal-ext.properties
file in Liferay Home, reference your mail session:mail.session.jndi.name=java:jboss/mail/MailSession
You’ve got mail! Next, you’ll deploy Liferay DXP to your JBoss app server.
Deploying Liferay DXP
-
If the folder
$JBOSS_HOME/standalone/deployments/ROOT.war
already exists in your JBoss installation, delete all of its subfolders and files. Otherwise, create a new folder called$JBOSS_HOME/standalone/deployments/ROOT.war
. -
Unzip the Liferay DXP
.war
file into theROOT.war
folder. -
To trigger deployment of
ROOT.war
, create an empty file namedROOT.war.dodeploy
in your$JBOSS_HOME/standalone/deployments/
folder. On startup, JBoss detects the presence of this file and deploys it as a web application. -
Start the JBoss application server by navigating to
$JBOSS_HOME/bin
and runningstandalone.bat
orstandalone.sh
.
Congratulations; you’ve now deployed Liferay DXP on JBoss!