Installing Liferay Portal on Wildfly

Liferay Portal CE 7.1 bundled with Wildfly 11 is available on the Customer Portal (DXP) or Liferay Downloads (Portal CE). Liferay Portal CE 7.1 supports deployment to Wildfly 10 and Wildfly 11. Even if you want to manually install Liferay Portal on an existing Wildfly application server, it can be helpful to download a Liferay Portal Wildfly bundle to make gathering the dependencies easier. Before proceeding, also download these files for DXP and Portal CE:

  • Liferay Portal WAR file
  • Dependencies ZIP file
  • OSGi JARs ZIP file

Installing Liferay Portal manually takes three steps:

Liferay Home is the folder containing your Wildfly server folder. After installing and deploying Liferay Portal, the Liferay Home folder contains the Wildfly server folder as well as data, deploy, logs, and osgi folders. $WILDFLY_HOME refers to your Wildfly server folder. It is usually named wildfly-[version].

Installing Dependencies

Liferay Portal depends on many JARs that are included in the Liferay Portal Wildfly bundle. Some of the bundle’s JARs are not strictly required but can still be useful. If you don’t have a Liferay Portal Wildfly bundle, download the required JARs from third-parties as described below.

  1. Create the folder $WILDFLY_HOME/modules/com/liferay/portal/main if it doesn’t exist and extract the dependencies ZIP JARs to it:

    • com.liferay.petra.concurrent.jar
    • com.liferay.petra.executor.jar
    • com.liferay.petra.function.jar
    • com.liferay.petra.lang.jar
    • com.liferay.petra.memory.jar
    • com.liferay.petra.nio.jar
    • com.liferay.petra.process.jar
    • com.liferay.petra.reflect.jar
    • com.liferay.petra.string.jar
    • com.liferay.registry.api.jar
    • hsql.jar
    • portal-kernel.jar
    • portlet.jar
  2. Download your database driver .jar file and copy it into the same folder. For example, copy MySQL’s driver into the $WILDFLY_HOME/modules/com/liferay/portal/main folder. The mariadb.jar, mysql.jar, and postgresql.jar driver JARs are also available in the Wildfly bundle.

  3. Create the file module.xml in the $WILDFLY_HOME/modules/com/liferay/portal/main folder and insert this configuration:

    <?xml version="1.0"?>
    <module xmlns="urn:jboss:module:1.0" name="com.liferay.portal">
            <resource-root path="com.liferay.petra.concurrent.jar" />
            <resource-root path="com.liferay.petra.executor.jar" />
            <resource-root path="com.liferay.petra.function.jar" />
            <resource-root path="" />
            <resource-root path="com.liferay.petra.lang.jar" />
            <resource-root path="com.liferay.petra.memory.jar" />
            <resource-root path="com.liferay.petra.nio.jar" />
            <resource-root path="com.liferay.petra.process.jar" />
            <resource-root path="com.liferay.petra.reflect.jar" />
            <resource-root path="com.liferay.petra.string.jar" />
            <resource-root path="com.liferay.registry.api.jar" />
            <resource-root path="hsql.jar" />
            <resource-root path="mysql.jar" />
            <resource-root path="portal-kernel.jar" />
            <resource-root path="portlet.jar" />
            <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" />

    If you use a different database, replace the MySQL .jar with the driver JAR for your database (e.g., HSQL, PostgreSQL, etc.).

  4. Create an osgi folder in your Liferay Home folder. Extract the OSGi ZIP file that you downloaded into the osgi folder.

    The osgi folder provides the necessary modules for Liferay Portal’s OSGi runtime.


  1. At this point, you should have the following files in the $WILDFLY_HOME/modules/com/liferay/portal/main folder:

    • com.liferay.petra.concurrent
    • com.liferay.petra.executor.jar
    • com.liferay.petra.function.jar
    • com.liferay.petra.lang.jar
    • com.liferay.petra.memory.jar
    • com.liferay.petra.nio.jar
    • com.liferay.petra.process.jar
    • com.liferay.petra.reflect.jar
    • com.liferay.petra.string.jar
    • com.liferay.registry.api.jar
    • portal-kernel.jar
    • portlet.jar
    • a database JAR such as the MySQL Connector.
  2. The module.xml has listed all JARs in the <resource-root-path> elements.

  3. The osgi folder has the following subfolders:

    • configs
    • core
    • marketplace
    • modules
    • portal
    • static
    • test
    • war

Great! You have your .jar files ready.

Running Liferay Portal on Wildfly in Standalone Mode vs. Domain Mode

Wildfly 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 Wildfly Admin Guide. Liferay Portal fully supports Wildfly in standalone mode but not in domain mode.

You can run Liferay Portal on Wildfly in domain mode, but this method is not fully supported. In particular, Liferay Portal’s hot-deploy does not work with a managed deployment, since Wildfly 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 Wildfly running in managed domain mode, since Liferay Portal’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 Wildfly

Configuring Wildfly to run Liferay Portal includes these things:

  • Setting environment variables
  • Setting properties and descriptors
  • Removing unnecessary configurations

Optionally, you can configure Wildfly to manage Liferay Portal’s data source and mail session.

Start with configuring Wildfly to run Liferay Portal.

Make the following modifications to $WILDFLY_HOME/standalone/configuration/standalone.xml:

  1. Locate the closing </extensions> tag. Directly beneath that tag, insert the following 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" />
  2. Add the following <filter-spec> tag within the <console-handler> tag, directly below the <level name="INFO"/> tag:

    <filter-spec value="not(any(match(&quot;WFLYSRV0059&quot;),match(&quot;WFLYEE0007&quot;)))" />
  3. 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" runtime-failure-causes-rollback="${jboss.deployment.scanner.rollback.on.failure:false}"/>
  4. 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">
            <login-module code="" flag="required" />
  5. Remove the following Weld-related tags:

    • <extension module=""/>
    • <subsystem xmlns="urn:jboss:domain:weld:4.0"/>
  6. Remove the two code snippets providing welcome content:

    <location name="/" handler="welcome-content"/>


        <file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>
  7. Find the <jsp-config/> tag and set the development, source-vm, and target-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" />


Before continuing, verify the following properties have been set in the standalone.xml file:

  1. The new <system-property> is added.

  2. The new <filter-spec> is added.

  3. The <deployment-timeout> is set to 360.

  4. The new <security-domain> is created.

  5. Weld tags are removed.

  6. Welcome content is removed.

  7. The <jsp-config> tag contains its new attributes.

Now you must configure your JVM and startup scripts.

In the $WILDFLY_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
  • Set the user time-zone
  • Set the preferred protocol stack
  • Increase the default amount of memory available.

Make the following edits as applicable for your operating system:


  1. Comment out the initial JAVA_OPTS assignment like this:

    rem set "JAVA_OPTS=-Xms64M -Xmx512M -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m"
  2. 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 -Duser.timezone=GMT -Xmx2048m -XX:MaxMetaspaceSize=512m -XX:MetaspaceSize=200m"


  1. Below the if [ "x$JAVA_OPTS" = "x" ]; statement, replace this JAVA_OPTS statement:

    JAVA_OPTS="-Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m"

    with this:

  2. Add the following statement to the bottom of the file:

    JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=UTF-8 -Duser.timezone=GMT -Xmx2048m -XX:MaxMetaspaceSize=512m -XX:MetaspaceSize=200m"


At this point, you’ve finished configuring the application server’s JVM settings.

  1. The file encoding, user time-zone, preferred protocol stack have been set in the JAVA_OPTS in the standalone.conf.bat file.

  2. The default amount of memory available has been increased.

The prescribed script modifications are now complete for your Liferay Portal installation on Wildfly. Next you’ll configure your database.

Database Configuration

The easiest way to handle database configuration is to let Liferay Portal manage your data source. The Basic Configuration page lets you configure Liferay Portal’s built-in data source. If you want to use the built-in data source, skip this section.

MySQL is used as the example below. If you’re using a different database, modify the data source and driver snippets as necessary.

If you want Wildfly to manage your data source, follow these steps:

  1. Add your data source inside $WILDFLY_HOME/standalone/configuration/standalone.xml file’s <datasources> element:

    <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" jta="true" use-java-context="true" use-ccm="true">

    Be sure to replace the database name (i.e., lportal), user name, and password with the appropriate values.

  2. Add your driver to the standalone.xml file’s <drivers> element also found within the <datasources> element:

        <driver name="mysql" module="com.liferay.portal">

    Your final data sources subsystem should look like this:

    <subsystem xmlns="urn:jboss:domain:datasources:1.0">
            <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" jta="true" use-java-context="true" use-ccm="true">
                <driver name="mysql" module="com.liferay.portal">
  3. In a file in your Liferay Home, specify your data source:

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 Portal handle your mail session. If you want to use Liferay Portal’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 Wildfly, follow these steps:

  1. 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" name="mail-smtp">
            <smtp-server ssl="true" outbound-socket-binding-ref="mail-smtp" username="USERNAME" password="PASSWORD"/>
    <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="" port="465"/>
  2. In your file in Liferay Home, reference your mail session:

You’ve got mail! Next, you’ll deploy Liferay Portal to your Wildfly app server.

Deploying Liferay Portal

Now you’re ready to deploy Liferay Portal using the Liferay Portal WAR file.

  1. If the folder $WILDFLY_HOME/standalone/deployments/ROOT.war already exists in your Wildfly installation, delete all of its subfolders and files. Otherwise, create a new folder called $WILDFLY_HOME/standalone/deployments/ROOT.war.

  2. Unzip the Liferay Portal .war file into the ROOT.war folder.

  3. To trigger deployment of ROOT.war, create an empty file named ROOT.war.dodeploy in your $WILDFLY_HOME/standalone/deployments/ folder. On startup, Wildfly detects the presence of this file and deploys it as a web application.

  4. Start the Wildfly application server by navigating to $WILDFLY_HOME/bin and running standalone.bat or

Congratulations; you’ve deployed Liferay Portal on Wildfly!

0 (0 Ääniä)
Installing Liferay Portal on Tomcat Edellinen