The Source for Java Technology Collaboration
User: Password:



Jean-Francois Arcand

Jean-Francois Arcand's Blog

Fronting GlassFish v3 with Apache httpd

Posted by jfarcand on August 27, 2008 at 02:50 PM | Comments (9)

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.

IMG_2419.JPG

Want to try it? Download GlassFish v3 (wait for tomorrow nightly as I enabled support today) and just edit:

% 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!

technorati:


Bookmark blog post: del.icio.us del.icio.us Digg Digg DZone DZone Furl Furl Reddit Reddit
Comments
Comments are listed in date ascending order (oldest first) | Post Comment

  • Looks like some kind of abuse of the id attribute. Can I set up two JK listeners? What about security key?

    Posted by: ecki on August 29, 2008 at 03:31 PM

  • You can setup 2 jk-listener by just changing the port number. Can you elaborate on the security key? Thanks.

    Posted by: jfarcand on September 02, 2008 at 01:30 PM

  • Hi, great to have this now in Version 3 !

    Did you also test, if it's working fine with apache 2.2 + mod_proxy_ajp module instead of apache + mod_jk ?

    http://httpd.apache.org/docs/2.2/mod/mod_proxy_ajp.html

    Posted by: thorleif on September 15, 2008 at 12:16 PM

  • useful,then how it could be if I used the cluster by AHS on GFv3?

    Posted by: dingis on November 19, 2008 at 05:06 AM

  • Take a look at the following link: http://blogs.sun.com/jluehe/entry/supporting_apache_loadbalancer_with_glassfish Thanks!

    Posted by: jfarcand on November 21, 2008 at 12:20 PM

  • This isn't very clear to someone who is trying to do this for the first time. Am I suppose to add the one property line to an existing http-listener?

    My guess was to copy the entire snippet of code. However, that didn't work. I tried adding a closing </http-listener> but that didn't work either. Did some of the HTML get eaten in your post?

    Posted by: mmellinger66 on December 08, 2008 at 01:20 PM

  • There are some typos in that config here is what you want to add

    <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"/>
    </http-listener>

    That goes inside the tag http-service tag... Also I had to change this line

    <virtual-server id="server" http-listeners="http-listener-1,http-listener-2">

    -- to this --

    <virtual-server id="server" http-listeners="jk-connector,http-listener-1,http-listener-2">


    I used mod_proxy_ajp on the server side since that is easier to configure IMO and does everything I need to well enough. Here is the apache side vhost config for having glassfish.bob.com served by glassfish. Obviously you need mod_proxy_ajp loaded for this to work google is your friend on that one.


    NameVirtualHost *:80
    <VirtualHost *:80>
    ServerName glassfish.bob.com
    ProxyPass / ajp://localhost:8009/
    </VirtualHost>


    Posted by: glen33 on May 20, 2009 at 04:35 PM

  • What would be the syntax to create an AJP listener in the new format of the config file in glassfish v3? The structure has changed quite a bit. Is it supported?

    Posted by: pascalpt on June 17, 2009 at 04:16 PM

  • Yes, just do:

    %asadmin create-jvm-options -Dcom.sun.enterprise.web.connector.enableJK=8009

    Posted by: jfarcand on June 17, 2009 at 07:19 PM



Only logged in users may post comments. Login Here.


Powered by
Movable Type 3.01D
 Feed java.net RSS Feeds