日期:2014-05-16  浏览次数:20976 次

Glassfish-v2和apache2.2.6的整合

1.下载mod_jk-1.2.26-httpd-2.2.4.so, 将文件放到modules目录下;

2.修改httpd.conf, 添加

LoadModule jk_module modules\mod_jk-1.2.26-httpd-2.2.4.so
JkWorkersFile conf/workers2.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 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 /webapp/* worker1

3.创建workers2.properties, 位于conf目录下, 添加如下内容

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

4.添加库文件

拷贝$CATALINA_HOME/server/lib/tomcat-ajp.jar 到$GLASSFISH_HOME/lib/;

从Jakarta Commons下载?commons-logging.jarcommons-modeler.jar放到$GLASSFISH_HOME/lib/;

5.添加jvm options -Dcom.sun.enterprise.web.connector.enableJK=8009, 可以在命令行里用

$GLASSFISH_HOME/bin/asadmin create-jvm-options -Dcom.sun.enterprise.web.connector.enableJK=8009或者在glassfish的控制台里Application Server -> JVM Settings ->JVM Options里添加;

6. 重新启动apache和glassfish

参考http://weblogs.java.net/blog/jfarcand/archive/2006/03/running_glassfi_1.html

?