The Source for Java Technology Collaboration
User: Password:



Amy Roh's Blog

Amy Roh Amy Roh has been working for Java 2 Enterprise Edition at Sun Microsystems since 2000 where her focus has been on webtier technologies including Servlet and web container. She is also a community leader for java-enterprise community on java.net, a project owner for GlassFish, a committer for Jakarta Tomcat project at Apache foundation, and an honorary member of the BluePrints team.



Running GlassFish V3 with Apache httpd

Posted by amyroh on June 24, 2009 at 04:36 PM | Permalink | Comments (4)

GlassFish V3 has improved the way to front GlassFish with Apache HTTP Server. Unlike the V2 way where users had to copy tomcat-ajp.jar and commons-*.jar, you can just enable mod_jk in V3 using the network-listener's attribute "jk-enabled" without copying any additional jars into its lib directory. You can also create jk-connectors under different virtual-servers (not just default virtual-server "server" in V2) using the network-listener's "jk-enabled" attribute.

Here are instructions.

(1) Install Apache HTTP Server and mod_jk

(2) Configure workers.properties and httpd.conf

For example, apache2/config/workers.properties

# Define 1 real worker using ajp13
worker.list=worker1
# Set properties for worker1 (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009

apache2/conf/httpd.conf

LoadModule jk_module /Users/Amy/apache2/modules/mod_jk-1.2.25-httpd-2.2.4.so
JkWorkersFile /Users/Amy/apache2/conf/worker.properties
# Where to put jk logs
JkLogFile /Users/Amy/apache2/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 indicate to send SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T"
# Send everything for context /examples to worker named worker1 (ajp13)
JkMount /examples/* worker1

(3) Start Apache HTTP Server

(4) Enable mod_jk using the following command

asadmin create-http-listener --listenerport 8009 --listeneraddress 0.0.0.0 --defaultvs server my-connector

asadmin set configs.config.server-config.network-config.network-listeners.network-listener.jk-connector.jk-enabled=true


(5) If you are using the glassfish-jk.properties file and not referencing it in httpd.conf, point to it using the following command:

asadmin create-jvm-options -Dcom.sun.enterprise.web.connector.enableJK.propertyFile=domain-dir/config/glassfish-jk.properties

(6) Restart GlassFish

The network-listener attribute "jk-enabled" is available from V3 b53 or later.

June 2009
Sun Mon Tue Wed Thu Fri Sat
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30        


Search this blog:
  

Categories
Community
Community: Glassfish
Community: Java Enterprise
J2EE
Open Source
Archives

June 2009
May 2007
August 2006
May 2006
February 2006
November 2005
July 2005
June 2005

Recent Entries

Running GlassFish V3 with Apache httpd

Context (webapp) configuration in GlassFish

GlassFish supports configurable AJP Connector.



Powered by
Movable Type 3.01D


 Feed java.net RSS Feeds