The Source for Java Technology Collaboration
User: Password:
Register | Login help    

Search

Online Books:
java.net on MarkMail:


Fronting GlassFish v3 with Apache httpd

Posted by jfarcand on August 27, 2008 at 2:50 PM PDT

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:

Related Topics >> Glassfish      
Comments
Comments are listed in date ascending order (oldest first)

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?

Yes, just do: %asadmin create-jvm-options -Dcom.sun.enterprise.web.connector.enableJK=8009

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>

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

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

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

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

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?