`
dinghy
  • 浏览: 34918 次
  • 性别: Icon_minigender_1
  • 来自: 京广之间
社区版块
存档分类
最新评论

GlassFish v3 与 Apace Http Server的简易搭配

阅读更多

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:

  1. Obtain and install Apache 2.0.x or 2.2.x HTTP Server (http://httpd.apache.org/).

  2. 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.

  3. Start httpd.

  4. 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
  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 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
评论
3 楼 jerryscott2009 2008-12-02  
  感谢回复,看来要等glassfish的下一个版本了,毕竟mod_proxy有这么多好的方式。
  现在有一个启动优化的问题,就是glassfish由于是应用服务器,因此默认启动了许多服务,如果我只需要WEB服务的支持,能否在启动过程中屏蔽掉对诸如MQ EJB等模块的支持呢,这些该如何配置呢。
2 楼 dinghy 2008-12-01  
v2应该还不支持ahs2.2...因为刚看到官方文章说v2.1中刚刚可以支持ahs2.2下的loadbalancer.
不过你可以仿效v3下的设置,在相应的http-listener下,设置 <property name"jkEnabled" value="[true|false]">,
have a try,~~~
1 楼 jerryscott2009 2008-11-28  
   您好,最近我也在学习glassfish,就apache2.2和glassfish整合的问题,想请教
1. 你这篇文章介绍的是glassfishV3的版本,对于glassfishV2的是不是一样

2. 现在apache2.2后均使用mod_proxy的配置,但我配置了很久却无法将缺省的请求(80)的转到glassfish下面的http listener下(我当时想得很简单,如果用mod_proxy的正向代理,那么只要在http.conf下面 将请求转发到我在glassfish配置下的http listener即可,结果搞了半天都没有反应)

3. 是不是现在glassfishV2对于mod_proxy的那种方式不支持啊,网络上的文章都好像没有很明显介绍,能否指点一二呢。

相关推荐

    Sun Glassfish v3 Administration 2009/12 PDF

    ### Glassfish v3 管理与配置指南 #### 标题解读 - **"Sun Glassfish v3 Administration 2009/12 PDF"**:此标题指明了文档的主题是关于Sun Microsystems(现已被Oracle收购)的Glassfish v3应用服务器的管理与配置...

    glassfish v3 application server (I)

    引起鱼猫之争的东东 可与tomcat 媲美,看好它

    jmaki development with sun glassfish v3

    ### jMaki Development with Sun GlassFish V3:深入解析与应用实践 #### 一、概述 jMaki 是一种用于创建动态网页的轻量级框架,它为开发人员提供了简化的方式来构建基于 Java 的 Web 应用程序。本文档旨在介绍...

    GlassFish v3

    - **定义与背景**:GlassFish v3是一款由Sun Microsystems开发的企业级应用服务器,它基于Java平台标准(Java Platform, Enterprise Edition,简称Java EE)构建。该版本作为GlassFish系列中的一个重要里程碑,在...

    glassfish v3 集群搭建完全手册(自己写的教程)

    DAS(Domain Administration Server)是管理Glassfish服务器的核心工具。首先,你需要在主服务器上安装Glassfish,然后通过DAS进行集群的管理和配置。 #### 1.2 创建节点 节点是集群的基本组成部分,每个物理机或...

    glassfish v3 application server (II)

    引起鱼猫之争的东东 可与tomcat 媲美,看好它

    Demo - EhCache Distributed Caching With Terracotta in GlassFish v3

    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相关知识点 #### 一、概述 Oracle GlassFish Server 3.1是一款基于Java EE标准的应用服务器,由Oracle公司维护并发布。它为开发人员提供了一个灵活、高性能且开放源码的平台来构建...

    GlassFishServer是JavaEE的开源参考实现

    GlassFish Server,作为Java EE(Enterprise Edition)的开源参考实现,是Java开发者和企业级应用部署的重要平台。这个服务器提供了一个全面的环境,用于开发、测试和运行符合Java EE规范的应用程序。Java EE是一个...

    glassfish-v3-windows.part1

    glassfish-v3-windows.part1

    Java EE 6 with GlassFish 3 Application Server

    在"Java EE 6 with GlassFish 3 Application Server"中,我们可以学习到以下几个关键知识点: 1. **模块化**:Java EE 6引入了模块化的概念,允许开发者根据需要选择要使用的Java EE组件,如EJB(Enterprise ...

    SunGlassFish Enterprise Server v3 Application Development Guide

    - **安装与配置**:提供了关于如何在不同的操作系统上安装和配置Sun GlassFish Enterprise Server v3的详细步骤。 ##### 2. **应用程序开发** - **Java EE支持**:强调了如何利用Java EE平台提供的API和技术(如...

    glassfish-v3-windows.part4

    glassfish-v3-windows.part4

    glassfish-v3-windows.part2

    glassfish-v3-windows.part2

    glassfish安装配置文档

    本文档将指导 readers 通过安装和配置 GlassFish 服务器,并将其与 Eclipse 集成以便进行调试。 一、GlassFish 安装 GlassFish 安装非常简单,只需要下载 GlassFish 安装程序,运行安装程序,然后按照向导的提示...

    Java EE 5 Development using GlassFish Application Server.part2.rar

    Java EE 5 Development using GlassFish Application Server

    GlassFish5.0安装包

    【GlassFish 5.0 安装与配置详解】 GlassFish,由Oracle公司主导的开源项目,是一款功能强大的Web服务器和应用服务器,以其卓越的性能和丰富的特性在开发者社区中备受推崇。相比于Tomcat,GlassFish提供了更全面的...

Global site tag (gtag.js) - Google Analytics