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
- Complete Task: Configure mod_jk Worker Nodes.
- Navigate to the location of the clustered server instance.
- Open
JBOSS_EAP_DIST/jboss-as/server/PROFILE/deploy/jbossweb.sar/server.xml
. - Specify the node name by appending the
jvmRoute
attribute to the <Engine> element inserver.xml
. The jvmRoute attribute value is the node name defined inHTTPD_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. - 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" />
- 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.