Home > Uncategorized > Running GlassFish with Apache httpd

Running GlassFish with Apache httpd

Quick blog to update the way you can front GlassFish with Apache httpd. Starting with build 41, all Jakarta Commons classes has been renamed from org.apache.* to com.sun.org.apache.* . Since mod_jk uses some of those classes, you need to add a couple of Jakarta Commons packages to make it works. Let’s do it steps by steps:

(1) First, install mod_jk

Next steps is to configure httpd.conf and worker.properties. For example, add in /etc/httpd/conf/httpd.conf:


LoadModule jk_module /usr/lib/httpd/modules/mod_jk.so
JkWorkersFile /etc/httpd/conf/worker.properties
# Where to put jk logs
JkLogFile /var/log/httpd/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
# Send all glassfish-test requests to GlassFish
JkMount /glassfish-test/* worker1

The add in your /etc/httpd/conf/worker.properties


# Define 1 real worker using ajp13
worker.list=worker1
# Set properties for worker1 (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=localhost.localdomain
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

Start httpd.

(2) Copy, from a fresh Tomcat 5.5.16 installation


cp $CATALINA_HOME/server/lib/tomcat-ajp.jar
$GLASSFISH_HOME/lib/.

Next, copy commons-logging.jar and commons-modeler.jar from the Jakarta Commons site under to $GLASSFISH_HOME/lib/.

(3) Then enable mod_jk by adding:


$GLASSFISH_HOME/bin/asadmin create-jvm-options -Dcom.sun.enterprise.web.connector.enableJK=8009

Then start GlassFish. That’s it!
technorati:

_uacct = “UA-3111670-1″;
urchinTracker();

About these ads
Categories: Uncategorized
  1. June 1, 2010 at 7:57 pm

    Hey.. it’s run with GFv3 too :)

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 52 other followers

%d bloggers like this: