Deploy as a WAR in JBoss EAP 7 - Documentation topics on: dotcms war,eap,ejb,j2ee,jboss,redhat,war,.

Deploy as a WAR in JBoss EAP 7

1. Add JDBC drivers and jamm modules to JBoss.

The JDBC drivers and jamm jar can be found on this GitHUb repo: These are used for the -javaagent vm option (see step 2, below).


A. Clone the repository into a folder
B. Navigate to the folder where you cloned the appservers-config repo
C. Copy all subfolders in jboss/modules to the modules/system/layers/base folder in the JBoss distribution, as follows:

cp -a $APPSERVERS-CONFIG-REPO/docs/examples/jboss/modules/* $JBOSS_HOME/modules/system/layers/base/.

A. Clone the repository into a folder
B. In Windows Explorer, navigate to the folder where you cloned the appservers-config repo
C. Copy all subfolders in jboss\modules to the modules\system\layers\base folder in the JBoss distribution.

2. Edit the JBoss standalone configuration file.

These changes set the javaagent option that allow dotCMS to use the java instrumentation.


Edit $JBOSS_HOME/bin/standalone.conf and replace the section shown here:

if [ "x$JAVA_OPTS" = "x" ]; then
   JAVA_OPTS="-Xms1303m -Xmx1303m -XX:MaxPermSize=256m"
   JAVA_OPTS="$JAVA_OPTS -Djboss.modules.system.pkgs=$JBOSS_MODULES_SYSTEM_PKGS -Djava.awt.headless=true"
   echo "JAVA_OPTS already set in environment; overriding default settings with values: $JAVA_OPTS"

with the following:

if [ "x$JAVA_OPTS" = "x" ]; then
   if [ -n "$JBOSS_MODULES_SYSTEM_PKGS" ]; then

   JAVA_OPTS="-Xms1303m -Xmx1303m -XX:MaxPermSize=256m"
   JAVA_OPTS="$JAVA_OPTS -Djboss.modules.system.pkgs=$JBOSS_MODULES_SYSTEM_PKGS -Djava.awt.headless=true"
   JAVA_OPTS="$JAVA_OPTS -javaagent:$JBOSS_HOME/modules/system/layers/base/org/github/jamm/main/dot.jamm-0.2.5_2.jar"
   echo "JAVA_OPTS already set in environment; overriding default settings with values: $JAVA_OPTS"
  1. Set the %JBOSS_HOME% environment variable to point to the JBoss distribution directory.
  2. Edit %JBOSS_HOME%\bin\standalone.conf.bat and replace the line shown here:
set "JAVA_OPTS=%JAVA_OPTS% -Djboss.modules.system.pkgs=org.jboss.byteman"

with the following:

if not "x%JBOSS_MODULES_SYSTEM_PKGS%" == "x" (
  set "JBOSS_MODULES_SYSTEM_PKGS=%JBOSS_MODULES_SYSTEM_PKGS%,org.jboss.byteman,org.github.jamm"

  set JBOSS_MODULES_SYSTEM_PKGS=org.jboss.byteman,org.github.jamm
set "JAVA_OPTS=%JAVA_OPTS% -Djboss.modules.system.pkgs=%JBOSS_MODULES_SYSTEM_PKGS% -Djava.awt.headless=true"

set "JAVA_OPTS=%JAVA_OPTS% -javaagent:%JBOSS_HOME%\modules\system\layers\base\org\github\jamm\main\dot.jamm-0.2.5_2.jar"

3. Edit the $JBOSS_HOME/standalone/configuration/standalone.xml file.

A. Configure the server to deploy dotcms.war on context root, as follows:

<subsystem xmlns="urn:jboss:domain:undertow:3.1">
    <buffer-cache name="default"/>
    <server name="default-server">
        <http-listener name="default" socket-binding="http" redirect-socket="https"/>
        <host name="default-host" alias="localhost">
            <location name="/" handler="welcome-content"/>
            <filter-ref name="server-header"/>
            <filter-ref name="x-powered-by-header"/>
    <servlet-container name="default">
        <file name="welcome-content" path="${jboss.home.dir}/standalone/deployments/dotcms.war"/>
        <response-header name="server-header" header-name="Server" header-value="JBoss-EAP/7"/>
        <response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow/1"/>

B. Update the datasources section to include your driver DB and set the details for your datasource connection. For example, for postgres a basic configuration would be:

<datasource jndi-name="java:/jdbc/dotCMSPool" pool-name="jdbc/dotCMSPool" enabled="true" use-java-context="true">
       <driver name="postgresql" module="com.dotcms.postgres">

Note: consider to set the correct connection parameters (min/max connections allowed, transaction timeouts, etc) according to your environment needs. This example is used as a reference.

C. Modify the default mail session by java:/mail/MailSession

<subsystem xmlns="urn:jboss:domain:mail:2.0">
    <mail-session name="mail-smtp" jndi-name="java:/mail/MailSession">
        <smtp-server outbound-socket-binding-ref="mail-smtp"/>

4. Deploy the exploded WAR file

unzip dotcms.war -d $JBOSS_HOME/standalone/deployments/dotcms.war
cd $JBOSS_HOME/standalone/deployments/
touch dotcms.war.dodeploy

A. In Windows Explorer, change to the WAR folder in the dotCMS distribution
B. Rename dotcms.war to
C. Right-click and select “Extract All”
D. Click the Extract button in the dialog box
E. Move or copy the dotcms.war folder to the standalone\deployments folder in the JBoss distribution
F. Right-click in the standalone\deployments folder in the JBoss distribution and select New ==> Text File
G. Rename the file to dotcms.war.dodeploy
H. Click the Yes button to confirm changing the file extension

*Login to the dotCMS back-end and add an Enterprise license.

*Note: Running dotCMS as a WAR file is only supported in dotCMS Enterprise edition, so the dotCMS front-end will not run without an Enterprise license.

5. Un-deploying the WAR

To un-deploy the exploded WAR:

rm $JBOSS_HOME/standalone/deployments/dotcms.war.deployed

Remove the dotcms.war.deployed file in the JBoss standalone\deployments directory.

6. Create jboss-web.xml and jboss-deployment-structure.xml files under $JBOSS_HOME/standalone/deployments/dotcms.war/WEB-INF/lib

In the jboss-web.xml file you need to set the default context-root for the application, as follows:

<?xml version="1.0" encoding="UTF-8"?>
<jboss-web xmlns="" xmlns:xsi=""

On the other hand, in the jboss-deployment-structure.xml you need to exclude the org.apache.commons.logging module that is used by JBoss by default, in order to avoid conflict with slf4j used by dotCMS.

          <module name="org.apache.commons.logging" />

7. Add or edit the admin user to JBoss.

Run the JBoss add-user script:






Then perform the following steps (on both Linux and Windows):

A. Select Management User (a).
B. UserName: admin
C. Type yes and press Enter to confirm
D. Password: [Enter a Password]
E. When prompted for groups, press Enter for no groups.
F. Type yes and press Enter to confirm.
G. When prompted “Is this user going to be used for one AS process to connect to another AS process?“, type no and press Enter.

8. Start the JBoss server.