3.2. Configuring JBoss to work with mod_jk

Task: Configure JBoss Enterprise Application Platform to Operate Using mod_jk

Complete this task to correctly prepare a JBoss Enterprise Application Platform instance on a clustered node to receive forwarded requests from the mod_jk load balancer.
Repeat this task for each server instance you require, observing the warnings at each step.

Prerequisites

  1. Navigate to the location of the clustered server instance.
  2. Open JBOSS_EAP_DIST/jboss-as/server/PROFILE/deploy/jbossweb.sar/server.xml.
  3. Specify the node name by appending the jvmRoute attribute to the <Engine> element in server.xml. The jvmRoute attribute value is the node name defined in HTTPD_DIST/conf/workers.properties.
    <!--Preceeding syntax removed for readability -->
    <Engine name="jboss.web" defaultHost="localhost" jvmRoute="node1">
    <!--Proceeding syntax removed for readability -->
    </Engine>

    Important

    If you intend to configure more than one server node in a cluster, ensure you change the jvmRoute attribute value to a unique name each time you repeat this step.
  4. In server.xml, ensure the AJP protocol <connector> element is enabled (uncommented). The element is uncommented by default in new installations.
    <Connector protocol="AJP/1.3" port="8009" address="${jboss.bind.address}"
       redirectPort="8443" />
  5. You now have a correctly configured Apache HTTP Server with mod_jk load balancer, which balances calls to the servlet containers in the cluster, and ensures clients will always use the same servlet container (sticky sessions).

Note

For supplementary information about using mod_jk with JBoss, refer to the JBoss wiki page at https://community.jboss.org/wiki/UsingModjk12WithJBoss.