Fronting GlassFish v3 with Apache httpd
http://weblogs.java.net/blog/jfarcand/archive/2008/08/fronting_glassf.html
GlassFish v2 supported Apache httpd for a while...but when we started GlassFish v3, we dropped such support to focus on things like modularity, performance, a monster called Grizzly, etc. Hence previous version of v3 couldn't be used with Apache via Tomcat's mod_jk....that's no longer the case. Better, we have simplified the way to do it. You no longer needs special jars file from Tomcat. Apache support is now fully included inside our distribution, which makes it quite simple to enable. Much simpler that what I've described here
GF v2支持AHS有段时间了...而当我们开始GF v3的开发后,放弃了这样的支持以专注于某些方面,像模块性,性能,以及变态的Grizzly引擎等等.因此v3前面的版本不便和Apache通过Tomcat的Mod_JK一起使用....还好这种情况没有延续太久.而且我们现在实现了这一功能并进行简化了配置.你不再需要从Tomcat的Home下拷贝特别的jar文件.对Apache的支持已经完全整合在我们的发行版里面,相关的配置非常简单.就像下面的描述.
Want to try it? Download GlassFish v3 (wait for tomorrow nightly as I enabled support today) and just edit:
想尝试吗,下载GF v3吧,编辑domain.xml像这样:
% vi ${glassfish.home}/domains/domain1/config/domain.xml
and add under your http-listener:
<http-listener default-virtual-server="server" family="inet"
security-enabled="false" enabled="true" server-name=""
address="0.0.0.0" acceptor-threads="1" port="8009" id="jk-connector"
xpowered-by="true" blocking-enabled="false" >
<property name"jkEnabled" value="[true|false]">
That's it. Notice the port number. That's the one you need to add to your /etc/apache2/worker.properties file.
Haaaa!Much simpler than for GlassFish v2! The implementation is new so feel free to post your comments on the users@glassfish.dev.java.net alias in case you want...more!
Using mod_jk
To set up mod_jk, follow these steps:
-
Obtain and install Apache 2.0.x or 2.2.x HTTP Server (http://httpd.apache.org/).
-
Configure the following files:
Examples of these files are shown after these steps. If you use both worker.properties and glassfish-jk.properties files, the file referenced by httpd.conf, or referenced by httpd.conf first, takes precedence.
-
Start httpd.
-
Enable mod_jk using the following command:
asadmin set server-config.http-service.http-listener.listener.property.jkEnabled=true
|
For example:
asadmin set server-config.http-service.http-listener.http-listener1.property.jkEnabled=true
|
Or you can use the following deprecated command, provided for backward compatibility:
asadmin create-jvm-options -Dcom.sun.enterprise.web.connector.enableJK=8009
|
-
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
|
-
Restart the Enterprise Server.
Here is an example httpd.conf file:
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
Here is an example worker.properties or glassfish-jk.properties file:
# 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
分享到:
相关推荐
### Glassfish v3 管理与配置指南 #### 标题解读 - **"Sun Glassfish v3 Administration 2009/12 PDF"**:此标题指明了文档的主题是关于Sun Microsystems(现已被Oracle收购)的Glassfish v3应用服务器的管理与配置...
引起鱼猫之争的东东 可与tomcat 媲美,看好它
### jMaki Development with Sun GlassFish V3:深入解析与应用实践 #### 一、概述 jMaki 是一种用于创建动态网页的轻量级框架,它为开发人员提供了简化的方式来构建基于 Java 的 Web 应用程序。本文档旨在介绍...
- **定义与背景**:GlassFish v3是一款由Sun Microsystems开发的企业级应用服务器,它基于Java平台标准(Java Platform, Enterprise Edition,简称Java EE)构建。该版本作为GlassFish系列中的一个重要里程碑,在...
DAS(Domain Administration Server)是管理Glassfish服务器的核心工具。首先,你需要在主服务器上安装Glassfish,然后通过DAS进行集群的管理和配置。 #### 1.2 创建节点 节点是集群的基本组成部分,每个物理机或...
引起鱼猫之争的东东 可与tomcat 媲美,看好它
Demo of ehCache distributed caching with terracotta in glassFish v3 可以参考:http://blog.csdn.net/guobin0719/archive/2011/04/25/6361940.aspx
### Oracle GlassFish Server 3.1相关知识点 #### 一、概述 Oracle GlassFish Server 3.1是一款基于Java EE标准的应用服务器,由Oracle公司维护并发布。它为开发人员提供了一个灵活、高性能且开放源码的平台来构建...
GlassFish Server,作为Java EE(Enterprise Edition)的开源参考实现,是Java开发者和企业级应用部署的重要平台。这个服务器提供了一个全面的环境,用于开发、测试和运行符合Java EE规范的应用程序。Java EE是一个...
glassfish-v3-windows.part1
在"Java EE 6 with GlassFish 3 Application Server"中,我们可以学习到以下几个关键知识点: 1. **模块化**:Java EE 6引入了模块化的概念,允许开发者根据需要选择要使用的Java EE组件,如EJB(Enterprise ...
- **安装与配置**:提供了关于如何在不同的操作系统上安装和配置Sun GlassFish Enterprise Server v3的详细步骤。 ##### 2. **应用程序开发** - **Java EE支持**:强调了如何利用Java EE平台提供的API和技术(如...
glassfish-v3-windows.part4
glassfish-v3-windows.part2
本文档将指导 readers 通过安装和配置 GlassFish 服务器,并将其与 Eclipse 集成以便进行调试。 一、GlassFish 安装 GlassFish 安装非常简单,只需要下载 GlassFish 安装程序,运行安装程序,然后按照向导的提示...
Java EE 5 Development using GlassFish Application Server
【GlassFish 5.0 安装与配置详解】 GlassFish,由Oracle公司主导的开源项目,是一款功能强大的Web服务器和应用服务器,以其卓越的性能和丰富的特性在开发者社区中备受推崇。相比于Tomcat,GlassFish提供了更全面的...