Configuring GlassFish App Server with Apache httpd
Here are the step by step instructions to configure GlassFish App server with apache web server.
Install & configure mod_jk:
Install apache web server and install the corresponding mod_jk. For instance if you have installed apache web server 2.2.4, go to the connectors web site of apache and download from the binaries mod_jk of the corresponding version of your installed web server. Then simply remove the version and place it in the modules directory according to your OS (I use windows OS and place it in C:/apacheroot/modules/ )
Create Workers File:
Create workers properties file inside the conf directory. If there is no sample then create it.Here is one sample you can put
# Define 1 real worker using ajp13
worker.list=worker1
# Set properties for worker1 (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=hostname
worker.worker1.port=8009
worker.worker1.lbfactor=50
worker.worker1.cachesize=10
worker.worker1.cache_timeout=600
worker.worker1.socket_keepalive=1
worker.worker1.socket_timeout=300
Configure httpd.conf
This is the important step. Edit the httpd.conf from the conf directory.Here is one sample. Here I assume that I have defined the Apache web server root installation directory.
LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf/workers.properties
# Where to put jk logs
JkLogFile log/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 indicate to send SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T"
# Send all jsp requests to GlassFish
JkMount /*.jsp worker1
# Now add all your applications that want the request to be sent to glassfish
JkMount /yourapp/* worker1
Now start/re-start your webserver. If it fails it could be because of the path problems so go to the logs and identify the errors (apacheroot/logs/) and analyze all logs. If your web server starts bingo 
You need to copy tomcat-ajp.jar,commons-logging.jar and commons-modeler.jar to the glassfish library. The tomcat-ajp.jar can be obtained from a tomcat source and the other two from the commons library.
Enable mod_jk in GlassFish:
Use the following command to enable mod_jk at glassfish server/
$GLASSFISH_HOME/bin/asadmin create-jvm-options -Dcom.sun.enterprise.web.connector.enableJK=8009
Now re-start glassfish and try your apps through your webserver and there you go 
Most Viewed
Today's:
All time:
Last viewed:
- Reds ready to bide time for Neill
- Famous IT Quotes
- Conflict causing error messages - Virtual Host or Web Application not found
- IBM News
- good cartoons of RK Laxman
- Desktop Pin
- Node Synchronization in Websphere Application Server
- problem using iSeries (AS400) and hibernate first example
- Java Links
- Java Reporting using Jasper for iSeries
Comments