Deploy as a WAR in JBoss EAP 6.4 - Documentation topics on: dotcms war,eap,jboss,war,.

This documentation is a static copy for this version. For current documentation, see: http://dotcms.com/docs/latest

Deploy as a WAR in JBoss EAP 6.4

Note:

  • This document includes only installation steps specific to this application server.
  • Before following the steps below, please review and follow the general instructions in the WAR Installation documentation.

The following steps are required to install dotCMS on JBoss EAP 6.4. Please click on the links for more detail on each step.

  1. Download and unzip JBoss
  2. Clone the dotCMS repository
  3. Copy JBoss modules
  4. Modify the JBoss standalone.conf file
  5. Modify the JBoss standalone.xml file
  6. Deploy the WAR
  7. Create and modify XML files in the dotCMS WEB-INF/lib folder
  8. Create and modify code files in the dotCMS WEB-INF/lib folder
  9. Add or edit the admin user to JBoss
  10. Start the JBoss server

1. Download and unzip JBoss

Download and unzip the jboss EAP 6.4.0 distribution.

Note:

  • To see the EAP 6.4.0 download links, click the View Older Downloads link.
  • In the download links, select the Zip files (rather than the Installer).

2. Clone the dotCMS repository

Clone the dotCMS Github repository https://github.com/dotCMS/appservers-config into a folder, and then navigate to that folder.

3. Copy JBoss modules

Copy all subfolders from the dotCMS jboss/modules folder to the JBoss modules/system/layers/base folder:

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

4. Modify the JBoss standalone.conf file

Add the following section to the $JBOSS_HOME/bin/standalone.conf file to ensure Java is started with the options necessary for dotCMS:

if [ "x$JAVA_OPTS" = "x" ]; then
    if [ -n "$JBOSS_MODULES_SYSTEM_PKGS" ]; then
        JBOSS_MODULES_SYSTEM_PKGS="$JBOSS_MODULES_SYSTEM_PKGS,net.bytebuddy.agent"
    else
        JBOSS_MODULES_SYSTEM_PKGS="net.bytebuddy.agent"
    fi
    JAVA_OPTS="-Xms1303m -Xmx1303m -Djava.net.preferIPv4Stack=true"
    JAVA_OPTS="$JAVA_OPTS -Djboss.modules.system.pkgs=$JBOSS_MODULES_SYSTEM_PKGS -Djava.awt.headless=true"
    JAVA_OPTS="$JAVA_OPTS -Djboss.modules.policy-permissions=true"
    JAVA_OPTS="$JAVA_OPTS -javaagent:$JBOSS_HOME/modules/system/layers/base/net/bytebuddy/agent/main/byte-buddy-agent-1.6.12.jar"
else
    echo "JAVA_OPTS already set in environment; overriding default settings with values: $JAVA_OPTS"
fi

5. Modify the JBoss standalone.xml file

Make the following changes to the $JBOSS_HOME/bin/standalone.xml file.

A. Turn off the default enable-welcome-root option
<virtual-server name="default-host" enable-welcome-root="false">
    <alias name="localhost"/>
    <alias name="example.com"/>
</virtual-server>
B. Configure datasources
<datasources>
    <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
        <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
        <driver>h2</driver>
        <security>
            <user-name>sa</user-name>
            <password>sa</password>
        </security>
    </datasource>
    <datasource jndi-name="java:/jdbc/dotCMSPool" pool-name="jdbc/dotCMSPool" enabled="true" use-java-context="true">
        <connection-url>jdbc:postgresql://localhost:5432/dotcms</connection-url>
        <driver>postgresql</driver>
        <security>
            <user-name>postgres</user-name>
            <password>postgres</password>
        </security>
    </datasource>
    <drivers>
        <driver name="h2" module="com.h2database.h2">
            <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
        </driver>
        <driver name="postgresql" module="com.dotcms.postgres">
            <driver-class>org.postgresql.Driver</driver-class>
        </driver>
    </drivers>
</datasources>

6. Create and Deploy the dotCMS WAR file

cd $DOTCMS_HOME
bin/buildwar.sh
cd WAR
unzip ROOT.war -d $JBOSS_HOME/standalone/deployments/ROOT.war
cd $JBOSS_HOME/standalone/deployments/
touch ROOT.war.dodeploy

Note: For more information on generating the dotCMS WAR file, please see the WAR Installation documentation.

7. Create and modify XML files in the dotCMS WEB-INF/lib folder

Make the following changes in the folder $JBOSS_HOME/standalone/deployments/ROOT.war/WEB-INF/lib.

Create the jboss-web.xml file

In the jboss-web.xml file, set the default context-root for the application:

<?xml version="1.0" encoding="UTF-8"?>
<jboss-web xmlns="http://www.jboss.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss-web_5_1.xsd">
    <context-root>/</context-root>
</jboss-web>
Edit the jboss-deployment-structure.xml file

In the jboss-deployment-structure.xml file, exclude the org.apache.commons.logging module. This module is used by JBoss by default, but must be excluded to avoid conflict with the slf4j module used by dotCMS.

<jboss-deployment-structure>
   <deployment>
      <exclusions>
          <module name="org.apache.commons.logging" />
      </exclusions>
   </deployment>
</jboss-deployment-structure>

8. Create and modify code files in the dotCMS WEB-INF/lib folder

Make the following changes in the folder $JBOSS_HOME/standalone/deployments/ROOT.war/WEB-INF/lib.

  • Copy dot.ehcache-1.6.1_2.jar to the folder.
  • Remove tomcat-servlet-api-8.0.9.jar from $JBOSS_HOME/standalone/deployments/ROOT.war/WEB-INF/lib
  • Remove ProxyServletContextListener.java by commenting out the following lines in the ????? file:
    <listener>
        <listener-class>
            org.apache.felix.http.proxy.impl.ProxyServletContextListener
         </listener-class>
    </listener>-->
    

9. Add or edit the admin user to JBoss

  • Run the JBoss add-user script to create or update the admin user
    $JBOSS_HOME/bin/add-user.sh
    
  • Select Management User (a).
  • UserName: admin
  • Type yes and press Enter to confirm
  • Password: [Enter a Password]
  • When prompted for groups, press Enter for no groups.
  • Type yes and press Enter to confirm.
  • When prompted “Is this user going to be used for one AS process to connect to another AS process?“, type no and press Enter.

10. Start the JBoss server

bin/standalone.sh