Download mod_jk (mod_jk.so is a Tomcat connector.) Download HTTP Apache server.
And below I am describing the ways to configure mod_jk, HTTP Apache and Tomcat/Jboss AS
1). After downloading mod_jk rename this file as mod_jk.so
2). Place this file in the installed directory of apache in the below specified path –
3). Create the below mentioned files in the conf directory at the specified path
[YOUR-APACHE-DIRECTIORY/conf/ mod-jk.conf uriworkermap.properties worker.properties
4). Open the httpd.conf file and include a line to load the mod-jk.conf file at the time when server starts.
5). Open the mod_jk.conf file and enter the below mentioned lines-
# Load mod_jk module # Specify the filename of the mod_jk lib LoadModule jk_module modules/mod_jk.so # Where to find workers.properties JkWorkersFile conf/worker.properties # Where to put jk logs JkLogFile logs/mod_jk.log # Set the jk log level [debug/error/info] JkLogLevel debug # Select the log format JkLogStampFormat "[%a %b %d %H:%M:%S %Y]" # JkOptions indicates to send SSK KEY SIZE JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories # JkRequestLogFormat JkRequestLogFormat "%w %V %T" # Mount your applications JkMount /application/* node1 # You can use external file for mount points. # It will be checked for updates each 60 seconds. # The format of the file is: /url=worker # /examples/*=loadbalancer JkMountFile conf/uriworkermap.properties # Add shared memory. # This directive is present with 1.2.10 and # later versions of mod_jk, and is needed for # for load balancing to work properly JkShmFile logs/jk.shm # Add jkstatus for managing runtime data
JkMount status Order deny,allow Deny from all Allow from 127.0.0.1 JkMountCopy All
This file loads the mod_jk.so file at the time of server start and describes the path of properties files to read and other log and other file, the short description written there describes all.
6). Open the worker.properties and enter the below mentioned lines in this file-
# Define list of workers that will be used # for mapping requests worker.list=node1,status worker.list=node1,status # Define template worker.template.type=ajp13 worker.template.port=8009 # Define Node1 # modify the host as your host IP or DNS name. worker.node1.reference=worker.template worker.node1.host=localhost # Status worker for managing load balancer worker.status.type=status
7). Open the uriworkermap.properties and enter these few lines which detail the context root which we are going to use in our application.
# Simple worker configuration file # Mount the Servlet context to the ajp13 worker /jmx-console=node1 /jmx-console/*=node1 /web-console=node1 /web-console/*=node1 /myproject=node1 /myproject/*=node1
Look the entries for myproject.
8-a). Connecting with Tomact
Now one last change in the server.xml file in Tomact, this file you can find at the .plugins folder of the Eclipse in side the look or folder which conatins the name tomcat , inside that tomcat and then conf
Open the server.xml file and look for the line
<Engine name="Catalina" .....>
Comment this line and enter this line in place of that
<Engine name="Catalina" defaultHost="localhost" jvmRoute="node1">
Here jvmRoute is node1 because we have defined this list of workers of Tomcat in the worker.properties. Here your configuration ends, Now restart the Apache HTTP Server and than Tomcat server to view the changes.
Go and hit the URLs-
8-b). Connecting with Jboss AS
In my machine I have installed a external Jboss As 4.2.3.GA at the location C:dev\server\, so with reference to this localion I have given the path where my server.xml file resides. And I have also deployed my tjcandidate and tjemployer at the path C:\dev\server\jboss-4.2.3.GA\server\all\deploy\. At the folder location where you deploy the projects, there is a folder jboss-web.deployer which contains the server.xml file.
Open the server.xml file from the path –
Comment the below mention line same as done in Tomcat
<!--Engine name="jboss.web" defaultHost="localhost">-->
And enter this line
<Engine name="jboss.web" defaultHost="localhost" jvmRoute="node1">