Sunday, 13 March 2016

JVM settings at server instance level

Please read my earlier post for JVM settings in JBOSS

This article provides CLI commands to add/remove/change JVM settings at application level. 

Add Heap memory size at server instance level.

[domain@192.168.1.12:9999 /] /host=slave01/server-config=rpa1/jvm=jvm-rpa:add(heap-size=64m, max-heap-size=220m)
{
    "outcome" => "success",
    "result" => undefined,
    "server-groups" => {"undefined" => {"host" => {"slave01" => {"rpa1" => {"response" => {
        "outcome" => "success",
        "response-headers" => {
            "operation-requires-restart" => true,
            "process-state" => "restart-required"
        }
    }}}}}}
}

The fallowing JVM content has been added to  rpa1 server instance in host.xml file

<servers>
        <server name="rpa1" group="rpa-group" auto-start="true">
            <jvm name="jvm-rpa">
                <heap size="64m" max-size="220m"/>
            </jvm>
            <socket-bindings port-offset="100"/>
        </server>

Adding  HeapDumpOnOutOfMemoryError parameter to specific server instance

[domain@192.168.1.12:9999 /] /host=slave01/server-config=rpa1/jvm=jvm-rpa:write-attribute(name=jvm-options,value=["-XX:+HeapDumpOnOutOfMemoryError"])
{
    "outcome" => "success",
    "result" => undefined,
    "server-groups" => {"undefined" => {"host" => {"slave01" => {"rpa1" => {"response" => {
        "outcome" => "success",
        "response-headers" => {
            "operation-requires-restart" => true,
            "process-state" => "restart-required"
        }
}


Adding  HeapDumpPath parameter to specific server instance

[domain@192.168.1.12:9999 /] /host=slave01/server-config=rpa1/jvm=jvm-rpa: add-jvm-option (jvm-option="-XX:HeapDumpPath=/u03/local/opt/jboss-eap-6.2/mydomain/slave1/servers/rpa1/log")
{
    "outcome" => "success",
    "result" => undefined,
    "server-groups" => {"undefined" => {"host" => {"slave01" => {"rpa1" => {"response" => {
        "response-headers" => {
            "operation-requires-restart" => true,
            "process-state" => "restart-required"
        }
}

Check In host.xml file


  <servers>
        <server name="rpa1" group="rpa-group" auto-start="true">
            <jvm name="jvm-rpa">
                <heap size="64m" max-size="220m"/>
                <jvm-options>
                    <option value="-XX:HeapDumpPath=/u03/local/opt/jboss-eap-6.2/mydomain/slave2/servers/rpa2/log"/>
                    <option value="-XX:+HeapDumpOnOutOfMemoryError"/>
                </jvm-options>
            </jvm>
            <socket-bindings port-offset="100"/>
        </server>

If you want to add multiple JVM arguments to server instance,
The CLI command would be:

/host=slave01/server-config=rpa1/jvm=jvm-rpa:write-attribute(name=jvm-options,value=["-XX:+HeapDumpOnOutOfMemoryError","-XX:HeapDumpPath=/u03/local/opt/jboss-eap-6.2/mydomain/slave1/servers/rpa1/log","-Djava.net.preferIPv4Stack=true"]) 

Notice: We will have to bounce the application server for the property to take effect.

Check JVM settings through CLI
[domain@192.168.1.12:9999 /] /host=slave01/server-config=rpa1/jvm=jvm-rpa:read-resource
{                                                                                              
    "outcome" => "success",
    "result" => {
        "agent-lib" => undefined,
        "agent-path" => undefined,
        "debug-enabled" => undefined,
        "debug-options" => undefined,
        "env-classpath-ignored" => undefined,
        "environment-variables" => undefined,
        "heap-size" => "64m",
        "java-agent" => undefined,
        "java-home" => undefined,
        "jvm-options" => [
            "-XX:+HeapDumpOnOutOfMemoryError",
            "-XX:HeapDumpPath=/u03/local/opt/jboss-eap-6.2/mydomain/slave1/servers/rpa1/log",
            "-Djava.net.preferIPv4Stack=true"
        ],
        "max-heap-size" => "220m",
        "max-permgen-size" => undefined,
        "permgen-size" => undefined,
        "stack-size" => undefined,
        "type" => undefined
    }
}

Removing  a JVM parameters

[domain@192.168.1.12:9999 /] /host=slave01/server-config=rpa1/jvm=jvm-rpa:remove-jvm-option(jvm-option="-XX:HeapDumpPath=/u03/local/opt/jboss-eap-6.2/mydomain/slave1/servers/rpa1/log")
{
    "outcome" => "success",
    "result" => undefined,
    "server-groups" => {"undefined" => {"host" => {"slave01" => {"rpa1" => {"response" => {
        "outcome" => "success",
        "response-headers" => {
            "operation-requires-restart" => true,
            "process-state" => "restart-required"
        }
    }}}}}}
}


Check application server process, either these changes were effected or not. 

[jboss@middlewaretech log]$ ps -ef | grep -i rpa1

jboss    27158 17553  4 00:26 pts/5    00:00:39 /usr/java/jdk1.7.0_75/jre/bin/java -D[Server:rpa1] -Xms64m -Xmx220m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/u03/local/opt/jboss-eap-6.2/mydomain/slave1/servers/rpa1/log -Djava.net.preferIPv4Stack=true -D[Host Controller]=true -Djboss.domain.master.address=192.168.1.12 -Djava.awt.headless=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djboss.home.dir=/u03/local/opt/jboss-eap-6.2 -Djava.net.preferIPv4Stack=true -Djboss.domain.base.dir=/u03/local/opt/jboss-eap-6.2/mydomain/slave1 -Djboss.server.log.dir=/u03/local/opt/jboss-eap-6.2/mydomain/slave1/servers/rpa1/log -Djboss.server.temp.dir=/u03/local/opt/jboss-eap-6.2/mydomain/slave1/servers/rpa1/tmp -Djboss.server.data.dir=/u03/local/opt/jboss-eap-6.2/mydomain/slave1/servers/rpa1/data -Dlogging.configuration=file:/u03/local/opt/jboss-eap-6.2/mydomain/slave1/servers/rpa1/data/logging.properties -jar /u03/local/opt/jboss-eap-6.2/jboss-modules.jar -mp /u03/local/opt/jboss-eap-6.2/modules -jaxpmodule javax.xml.jaxp-provider org.jboss.as.server


Saturday, 12 March 2016

server groups

A server group is a collection of server instances that are managed and configured as one. In a managed domain, every application server instance belongs to a server group, even if it is the only member. The server instances in a group share the same profile configuration and deployed content. 

All servers (server instances) of the same server group perform the same tasks because they share the same profile configuration and deployed content.

A domain can consist of multiple server groups. Different server groups can be configured with different profiles and deployments. A domain can be configured with different server tiers providing different services.

Different server groups can also have the same profile and deployments. This can, for example, allow for rolling application upgrades where the application is upgraded on one server group and then updated on a second server group, avoiding a complete service outage.

Adding a Server Group

Launch the management CLI in Linux by typing the following text at the command prompt:
[domain@192.168.1.12:9999 /] /server-group=rpa-group:add(profile=full-ha, socket-binding-group=full-ha-sockets)
{
    "outcome" => "success",
    "result" => undefined,
    "server-groups" => undefined
}

fallowing content has been added to domain.xml
<server-groups>
        <server-group name="rpa-group" profile="full-ha">
            <socket-binding-group ref="full-ha-sockets"/>
        </server-group>
    </server-groups>


A server group includes the following mandatory attributes:

name: the server group name.
profile: the server group profile name.
socket-binding-group: the default socket binding group used for servers in the group. This name can be overridden on a per-server basis in host.xml. However, this is a mandatory element for every server group and the domain cannot start if it is missing.

A server group includes the following optional attributes:

deployments: the deployment content to be deployed on the servers in the group.
system-properties: the system properties to be set on servers in the group
jvm: the default JVM settings for all servers in the group. The host controller merges these settings with any other configuration provided in host.xml to derive the settings used to launch the server's JVM.
socket-binding-port-offset: the default offset to be added to the port values given by the socket binding group.

Removing a Server Group

You may want to remove a server group when you no longer need it—for example, in situations where no applications are running on these server groups.

[domain@192.168.1.12:9999 /] /server-group=main-server-group:remove
{
    "outcome" => "success",
    "result" => undefined,
    "server-groups" => undefined
}

Note : Unable to access Web Admin Console on JBoss EAP 6.2 and facing error : "Insufficient privileges to access".

When "domain.xml" is used without any profile and "server-group" then admin console shows "insufficient privileges"

Resolution
EAP 6.2.0 web console unnecessarily checks for the existence of a server-group.
As a work around, add a dummy profile and server group.

Adding a Server to a Server Group
[domain@192.168.1.12:9999 /] /host=slave01/server-config=rpa1:add(auto-start=true, group=rpa-group, socket-binding-port-offset=100)
{
    "outcome" => "success",
    "result" => undefined,
    "server-groups" => undefined
}


HOSTNAME is defined in host.xml in the JBOSS_HOME/domain/configuration directory.
SERVER_NAME is the name of the server that you want to add.
SERVER_GROUP_NAME is the name of the server group to which you want to add the new server.

fallowing content has been added to host.xml of slave01 HC.
<servers>
        <server name="rpa1" group="rpa-group" auto-start="true">
            <socket-bindings port-offset="100"/>
        </server>

Starting Servers in a Server Group
[domain@192.168.1.12:9999 /] /server-group=rpa-group:start-servers()
{
    "outcome" => "success",
    "result" => undefined,
    "server-groups" => undefined
}

Stopping Servers in a Server Group
[domain@192.168.1.12:9999 /] /server-group=rpa-group:stop-servers
{
    "outcome" => "success",
    "result" => undefined,
    "server-groups" => undefined
}

Removing a server

first stop the server, then you can able to remove the server.
[domain@192.168.1.12:9999 /] /host=slave02/server-config=server-two:stop(server=true)
{
    "outcome" => "success",
    "result" => "STOPPING"
}

[domain@192.168.1.12:9999 /] /host=slave02/server-config=server-two:remove()
{
    "outcome" => "success",
    "result" => undefined,
    "server-groups" => undefined
}



Friday, 4 March 2016

Clearing all messages from a queue through Shell Script

I have written a shell script to find out how many messages are struck in queue and purging/deleting messages from queue.

 Download the following script and store it in a location such as /usr/local/bin.
 Provide the file permissions and ownership for this script as you see fit. In this example, they are:

$ chmod 755 /usr/local/bin/clear-mq-messages.sh
$ chown mqm:mqm /usr/local/bin/clear-mq-messages.sh
$ ls -l /usr/local/bin/clear-mq-messages.sh
-rwxr-xr-x   1 mqm      mqm            1296 Oct 30 14:34 clear-mq-messages.sh

#!/usr/bin/ksh
echo -e "\nPlease enter the \"queuemanager\" !!!"
                read queuemanager
echo -e "\nPlease enter the \"input_queue\" !!!"
        read inputqueue

struck_message=`echo  "DISPLAY QL($inputqueue) CURDEPTH" | runmqsc $queuemanager | grep 'CURDEPTH(' | sed 's/.*CURDEPTH//' | tr -d '()'`

if [ $struck_message = "0" ]; then
   
echo -e "==============================================="
echo "now no messages in " $inputqueue
echo -e "==============================================="
echo -e "\n\nThank you!!! Bye!!!\n"
exit 0
else
echo -e "==============================================="
    echo "the" $inputqueue "CURDEPTH count is" $struck_message
echo -e "==============================================="

fi
echo -e "Would you really like to flush the $inputqueue? <y/N> "
read prompt
if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]
then
echo -e "************************************************"
echo "clear qlocal($inputqueue)" | runmqsc $queuemanager
 echo -e "************************************************"
               
struck_message2=`echo  "DISPLAY QL($inputqueue) CURDEPTH" | runmqsc $queuemanager | grep 'CURDEPTH(' | sed 's/.*CURDEPTH//' | tr -d '()'`

echo "Now the CURDEPTH count is" $struck_message2
echo -e "************************************************"
else
echo -e "\n\nThank you!!! Bye!!!\n\n"
                  exit 0
fi

Let see how this script will work

while script executing time this script will ask QueueManager name & queue name. 




 Let see CURDEPTH  count only....


If CURDEPTH count is zero, the script will work as below



I hope this information is helpful to you

Thursday, 3 March 2016

The WebSphere MQ Queue Load / Unload Utility

How to Load/UnLoad messages from Websphere MQ Queues Using Qload & Unload Utility

The WebSphere MQ Queue Load / Unload Utility allows the user to copy or move the contents of a queue, its messages, to a file. This file can be saved away as required and used at some later point to reload the messages back onto the queue. This file has a specific format understood by the utility, but is human-readable, so that it can be updated in an editor before being reloaded.

Create Queue Manager:
 crtmqm QM1
start Queue mqnqger:
strmqm QM1
Create local queues:
runmqsc QM1
DEFINE QLOCAL(Q1)
DEFINE QLOCAL(Q2)

Put 10 messages into queue1

Sample Commands :

1. Backup messages from a Queue to a file:
 qload –m QM1 –i Q1 –f /tmp/bkpmsg

2. import messages from a file to the queue:
qload –m QM1 –o LQ1 –f /tmp/bkpmsg

3. Copying messages from a queue to another queue:
qload –m QM1 –i Q1 –o Q2

4. Copying certain number of messages from a queue to another queue:
(e.g) we need to copy first 15 messages from a Q1 to Q2
qload –m QM1 –i Q1 –o Q2 –r#20

“-r” Parameter:
x  =  Process x messages only
x..y  =  Process messages between x and y
X#y  =  Process messages from x to y count
#y  =  Process first y count of messages (just like in e.g)

5. Move entire message from a queue to another queue:
qload –m QM1 –i Q1 –o Q2

6. Unload and remove 10 messages, starting at message 530:

qload –m QM1 –I Q1 –f /tmp/bkpmsg –dA –r53#10

7.Unload and remove messages from 43 to 52:

qload –m QM1 –I Q1 –f /tmp/bkpmsg –dA –r43..52

No messages are removed from the queue as the lower case “i” instructs qload to use browse.

8.Unload and remove first message on queue Q1, with deletion:


qload –m QM1 –I Q1 –f /tmp/bkpmsg –dA –r1

Friday, 5 February 2016

UPGRADING AND PATCHING THE JBOSS EAP

One of the biggest advantages, besides the support for the Red Hat JBoss Enterprise Middleware are the access to continuous updates and bug fixes. In previous versions, minor patches could not be applied automatically, also updates or bug fixes had to be installed manually, by changing individual configuration files and replacing Java Archives.
Since version 6.2 the Command Line Interface of the JBoss Enterprise Application Platform (EAP) contains a command to apply minor updates and patches without changing individual files manually.

JBoss patches are released in two forms.
Asynchronous updates: one-off patches which are released outside the normal update cycle of the existing product. These may include security patches, as well as other one-off patches provided by Red Hat Global Support Services (GSS) to fix specific issues.

Planned updates: These include cumulative patches, as well as micro, minor or major upgrades of an existing product. Cumulative patches include all previously developed asynchronous updates for that version of the product.

High level  Patch installation Steps:

1. Download the patch zip file from the Customer Portal at https://access.redhat.com/downloads/
2. From the Management CLI, apply the patch with the following command including the appropriate path to the patch file:
syntax :: patch apply /path/to/downloaded-patch.zip
 3. Restart the JBoss EAP 6 server for the patch to take effect:
syntax : shutdown --restart= true

-----------------------------------------------------------------------------------------------
                                    Detailed Steps  
-----------------------------------------------------------------------------------------------

1.Check version

[domain@192.168.1.12:9999 /] version
JBoss Admin Command-line Interface
JBOSS_HOME: /u03/local/opt/jboss-eap-6.2
JBoss AS release: 7.3.0.Final-redhat-14 "Janus"
JBoss AS product: EAP 6.2.0.GA
JAVA_HOME: null
java.version: 1.7.0_75
java.vm.vendor: Oracle Corporation
java.vm.version: 24.75-b04
os.name: Linux
os.version: 2.6.18-194.el5

2. Before patching   take a snapshot: Run the take-snapshot operation to capture a copy of the current server configuration
[domain@192.168.1.12:9999 /] :take-snapshot()
{
    "outcome" => "success",
    "result" => "/u03/local/opt/jboss-eap-6.2/mydomain/master/configuration/domain_xml_history/snapshot/20160205-104031406domain.xml"
}

3.Apply a patch through CLI on master domain:

[domain@192.168.1.12:9999 /] patch --host=master apply /u03/local/opt/jboss-eap-6.2/bin/jboss-eap-6.2.4-patch.zip  --override-modules
{
    "outcome" : "success",
    "response-headers" : {
        "operation-requires-restart" : true,
        "process-state" : "restart-required"
    },
    "result"  : null,
     "server-groups"   : null
}

4.Restart the JBoss EAP 6 host/server for the patch installation to take effect.

[domain@192.168.1.12:9999 /] /host=master:shutdown(restart=true)
{"outcome" => "success"}
[domain@192.168.1.12:9999 /]

5. Apply a patch through CLI on Slave domain:

Before patching take a snapshot Run the take-snapshot operation to capture a copy of the current server configuration.

[domain@192.168.1.12:29999 /] /host=slave02:take-snapshot()
{
    "outcome" => "success",
    "result" => "/u03/local/opt/jboss-eap-6.2/mydomain/slave2/configuration/host_xml_history/snapshot/20160205-111016532host-slave.xml",
    "server-groups" => undefined
}
[domain@192.168.1.12:29999 /]

Apply a patch on Slave 
[domain@192.168.1.12:29999 /] patch --host=slave02 apply /home/jboss/Desktop/jboss-eap-6.2.4-patch.zip  --override-modules
{
    "outcome" : "success",
    "response-headers" : {
        "operation-requires-restart" : true,
        "process-state" : "restart-required"
    }
    "result"  : null,
     "server-groups"   : null
}

Restart the slave for the patch installation to take effect.

[domain@192.168.1.12:29999 /] /host=slave02:shutdown(restart=true)
{"outcome" => "success"}
[domain@192.168.1.12:29999 /]

Note: after a patch has been applied, the jars picked up at runtime are picked up from the EAP_HOME/modules/system/layer/base/.overlays/$PATCH_ID/$MODULE directory.The original files are left in EAP_HOME/modules/system/layers/base/$MODULE. The patching mechanism cripples the original jar files for security reasons. This means that if you apply a patch which updates a module, the original module's jar files are altered to be unusable. If the patch is rolled back, the original files will be reverted back to a usable state.

check version after path applied:

[domain@192.168.1.12:29999 /] version
JBoss Admin Command-line Interface
JBOSS_HOME: /u03/local/opt/jboss-eap-6.2
JBoss AS release: 7.3.4.Final-redhat-14 "Janus"
JBoss AS product:  EAP 6.2.4.GA
JAVA_HOME: null
java.version: 1.7.0_75
java.vm.vendor: Oracle Corporation
java.vm.version: 24.75-b04
os.name: Linux
os.version: 2.6.18-194.el5
[domain@192.168.1.12:29999 /]

Patch history 

You can display the information about the history of the installed patches using the patch history command. Additionally the patch info command can show you all currently installed patches.

[domain@192.168.1.12:9999 /]patch  info --host=master
{
    "outcome" : "success",
    "result" : {
        "cumulative-patch-id" : "jboss-eap-6.2.4.CP",
        "patches" : ["eap-624-bz1281945"],
        "version" : "6.2.4.GA",
        "addon" : null,
        "layer" : {"base" : {
            "cumulative-patch-id" : "layer-base-jboss-eap-6.2.4.CP",
            "patches" : ["BZ1281945"]
        }}
    }
}

This information(history) are stored in the .installation directory inside the JBOSS_HOME directory of the JBoss Application Server. Be careful manipulating this directory, because changed files and the last configuration to perform a rollback are stored in this directory. However, it is always recommendable to make a backup before applying a patch.

[jboss@middlewaretech jboss-eap-6.2]$ cd /u03/local/opt/jboss-eap-6.2/.installation
[jboss@middlewaretech .installation]$  ls -ltr
total 12
drwxr-xr-x 4 jboss dba   4096 Feb  1 16:14 layers
drwxr-xr-x 4 jboss dba   4096 Feb  1 16:14 patches
drwxr-xr-x 4 jboss dba   4096 Feb  1 16:21 identity.conf

[jboss@middlewaretech .installation]$ cd patches
[jboss@middlewaretech .installation]$ ls -l
 drwx------. 4 jboss dba   4096 Feb  1 16:21 eap-624-bz1281945
drwx------. 4 jboss dba   4096 Feb  1 16:14 jboss-eap-6.2.1.CP
drwx------. 4 jboss dba   4096 Feb  1 16:14 jboss-eap-6.2.2.CP
drwx------. 4 jboss dba   4096 Feb  1 16:14 jboss-eap-6.2.3.CP
drwx------. 4 jboss dba   4096 Feb  1 16:14 jboss-eap-6.2.4.CP

Rollback the patches:

1. From the Management CLI, use the patch info command to find the ID of the patch that is to be rolled back.
  • For cumulative patches, the patch ID is the value of the first cumulative-patch-id shown in the patch info output.
  • Individual security or bug fix patch ID's are listed as the value of the first patches shown in the patch  info output, with the most recently applied individual patch listed first.

2. From the Management CLI, rollback the patch with the appropriate patch ID from the previous step.
syntax : patch rollback --patch-id = PATCH_ID  --host=master  --reset-configuration= TRUE  --override-all

3. Restart the JBoss EAP 6 server for the patch rollback to take effect:

-----------------------------------------------------------------------------------------------
                                    Detailed Steps  
-----------------------------------------------------------------------------------------------
Run the rollback command:

[domain@10.128.157.7:9999 /] patch rollback --patch-id=jboss-eap-6.2.4.CP --host=master --reset-configuration=true  --override-all
{
    "outcome" : "success",
    "response-headers" : {
        "operation-requires-restart" : true,
        "process-state" : "restart-required"
    }
}

When the patch is roll backed, the application server/host requires a restart, also executable with the CLI.
[domain@192.168.1.12:9999 /] /host=master:shutdown(restart=true)
{"outcome" => "success"}
[domain@192.168.1.12:9999 /]






Tuesday, 2 February 2016

Configuring Apache in front of JBoss Application Server Using mod_jk

This article provides a step by step guide on configuring Apache HTTP server as the Web server in front of the JBoss application server.

Apache servers balances the load among the JBoss applications servers via the mod_jk connector. The Jboss servers are configured in a cluster and hence when a server goes down, the subsequent user requests can be forwarded to a different server.

Why to Configure Apache HTTP server in front of JBoss Application Server?
  • Application servers are good at hosting Web applications, but they are not as good when it comes to serving static content, providing load balancing, URL rewriting, security etc. Following are some of the advantages of using Apache HTTP web server in front of an application server such as JBoss.
  • Apache is a high performance and highly secure Web server with advanced features
  • Apache comes with a lot of extension modules providing essential hosting features such as logging, virtual hosting, URL rewriting etc.
  • Apache can be used as a load balancer distributing load across multiple JBoss instances. Mod_jk connector supports advanced load balancing configurations.
  • A single Apache server instance can serve multiple domains using virtual hosting and at the same time they can all be serviced by different JBoss servers. This ensures process isolation for web applications hosted in each domain.
Apache to JBoss Request Routing – How It Works?

There are two different ways of configuring Apache to JBoss routing. One is to use the Tomcat connector available for Apache called the mod_jk connector. This is an Apache module specifically written by Tomcat team. This module routes the Apache to JBoss request via the AJP (Apache Jserv Protocol).

Second method is to use an Apache module called mod_proxy. This proxy can either use HTTP or AJP for routing request from Apache to JBoss. The advantage of mod_proxy is that it is available as a built in module in Apache 2.x versions.

When it comes to load balancing and failure detection, mod_jk is better than mod_proxy. The only disadvantage is the need to separately deploy  mod_jk module.

In either case, if the Apache connector is using AJP protocol, the AJP protocol listener must be enabled on the JBoss server. By default JBoss binds AJP service to the port 8009. Whenever a request is received by Apache, it looks at the AJP module configuration file(workers.properties) and if the request is intended for the JBoss server, the request is routed through AJP protocol to the port 8009(Please see the diagram above).


Configuring Apache to JBoss HTTP Request Routing Using Mod_Jk
  • The mod_jk HTTP connector has a single component, the mod_jk.so module loaded by the web server. This module receives client requests and forwards them to the container, in this case JBoss EAP 6. JBoss EAP 6 must also be configured to accept these requests and send replies back to the web server.
  • In order for JBoss EAP 6 to be able to communicate with the Apache HTTP server, it must have the AJP/1.3 connector enabled
  • In a managed domain, in server groups using the ha and full-ha profiles, and the ha or full-ha socket binding group. The other-server-group server group is configured correctly in a default installation.
  • In a standalone server, the standalone-ha and standalone-full-ha profiles are configured for clustered configurations.

To configure mod_jk integration, Download tomcat-connectors from the Tomcat site. 

[jboss@middlewaretech mod_jk]$ tar -zxvf tomcat-connectors-1.2.32-src.tar.gz
[jboss@middlewaretech mod_jk]$ cd tomcat-connectors-1.2.32-src/native/
[jboss@middlewaretech native]$ ./configure --with-apxs=/u03/local/opt/httpd-2.2.31/bin/apxs --enable-api-compatibility

Here /u03/local/opt/httpd-2.2.31/ is HTTP_HOME directory

[jboss@middlewaretech native]$ make
[jboss@middlewaretech native]$ make install


after completed this activity you will get mod_jk.so file in /u03/local/opt/httpd-2.2.31/modules/mod_jk.so

[jboss@middlewaretech modules]$cd /u03/local/opt/httpd-2.2.31/modules

[jboss@middlewaretech modules]$ ls -ltr
-rwxrwxr-x 1 jboss dba 878259 Feb  2 02:35 mod_jk.so

 if get it , going well
Installation part has been completed, let's start configuration part

Now create a new file named mod-jk.conf inside apache/conf folder. Add the following content to this file. 

LoadModule jk_module /u03/local/opt/httpd-2.2.31/modules/mod_jk.so
JkWorkersFile conf/workers.properties
JkShmFile logs/mod_jk.shm
JkLogFile logs/mod_jk.log
JkLogLevel info
JkMount /app/* server1
JkMount /app/* server2

The directive JkMount here ensures that all HTTP requests with context /app/ are forwarded to the server1 & server2 application server configured in workers.properties (see below).
Open httpd.conf in apache/conf folder and add the following line at the end of the file. This enables the mod-jk.conf file as an extension to the default configuration file.

Include conf/mod-jk.conf

Create a new file workers.properties inside apache/conf folder. Add the following content to the file. Note that the name of the JBoss node (server1, server2) corresponds to the JkMount configuration in mod-jk.conf file. The host in this case is given as 192.168.1.12 since I have the JBoss running on the same machine. In actual deployments replace 192.168.1.12 with the ip address/host name of the JBoss machine.

worker.list=server1,server2

# Define server1
# modify the host as your port & host IP or DNS name.
worker.server1.port=8089
worker.server1.host=192.168.1.12
worker.server1.type=ajp13

# Define server2
# modify the host as your  port & host IP or DNS name.
worker.server2.port=8039
worker.server2.host=192.168.1.12
worker.server2.type=ajp13

The above configuration indicates that there are two application server machine available for handling requests in the 192.168.1.12 and it is available through AJP protocol via port 8089 & 8039.
Restart apache and JBoss and access your Web application through Apache server using this 
URL – http:// 192.168.1.12:80/app.