Home | About me


Tomcat Clustering with Apache server: 

Installation of Apache Server:

         bala@bala-desktop:/usr/src/httpd-2.2.3$ ./configure --enable-mods-shared=all --with-apxs --enable-ssl=shared --enable-proxy=shared --prefix=/etc/apache2.2.3

        bala@bala-desktop:/usr/src/httpd-2.2.3$ make

        bala@bala-desktop:/usr/src/httpd-2.2.3$ make install


Installation of Tomcat: 

  • Get Tomcat 5.5.0 and create 2 instances named as tomcatA and tomcatB.
  • Uncomment the "Cluster" entry in server.xml for both instances. 
  • Change all the ports in conf/server.xml for tomcatB so that they will run on different ports. 
          For tomcatA:
            ConnectorPort: 8080 
            AJP ConnectorPort: 8009
            Proxied Http connector port: 8082
            shutdown port: 8005
            tcpListenPort: 4001
         For tomcatA:
        ConnectorPort: 8081
        AJP ConnectorPort: 8010
        Proxied Http connector port: 8083
        shutdown port: 8006
        tcpListenPort: 4002

Installation of JKConnector from source:

  • Download from 
  • Extract the inside /usr/src directory(Here after we will mention the extracted folder as JK_HOME).  
  • Create the by executing following command inside ${JK_HOME}/jk/native2/ 

            bala@bala-desktop: native2]$  ./configure –with-apxs2=/etc/apache2.2.3/bin/apxs 

  • Copy generated file from ${JK_HOME}/jk/build/jk2/apache2/ to /etc/apache2.2.3/modules directory.
  •  Create a file called inside /etc/apache2.2.3/conf directory with the following content.

    # Define the communication channel


    info=Ajp13 forwarding over socket




    info=Ajp13 forwarding over socket


    # Map the Tomcat examples webapp to the Web server uri space


    info=Map the whole webapp

  • Add the following lines at the end of /etc/apache2.2.3/conf/httpd.conf

                LoadModule jk2_module modules/

                     JkSet config.file /etc/apache2.2.3/conf/


Restart the apache server and start both instances of tomcat. 

Now you can access all the applications inside Tomcat instances through Apache webserver as http://localhost/jsp-examples :)

Note: web.xml of your application should have <distributable/> entry, so that session replication will work.