CFML

Serve CFML applications under Apache directory with Tomcat

In the comment section, about using Open BlueDragon with Tomcat, one user asked: “How do I get tomcat to serve my cfm pages from under an apache virtual server directory or is that not the right way. In other words how does one set up a virtual server running on port 80 if one has never used tomcat before?” I actually wanted to answer to him directly, but then thought I make it a blog entry on its own, since others might be interested as well.

What will follow is my setup with Apache and Tomcat.

1. Have Tomcat running on port 8080 (default).
2. Deploy the openbluedragon.war file.
3. Copy over the “bluedragon” and “WEB-INF” directories to your application.
4. Edit the server.xml file to add a host, like:

<Host name=”openbd.local”>
<Context path=”" docBase=”ABSOLUTEPATHTOYOURAPPLICATION”/>
</Host>

The docBase path can be the application you have already running on your website.

5. Restart Tomcat.

Now what you have to do is to forward any requests to openbd.local from Apache to Tomcat. Tomcat then serves the pages according to the docBase path. In Apache I have it setup like:

<VirtualHost *:80>
ServerName openbd.local
ProxyPass / http://openbd.local:8080/
ProxyPassreverse / http://openbd.local:8080/
HostnameLookups Off
</VirtualHost>

This works perfectly.

The only caveat with this is that each of my applications need a “WEB-INF” and a “bluedragon” folder. Making updating a “pain”. But apparently, this is the best way to serve pages from a J2EE server. Each application has its configuration and you can only enable what you need for that particular application.

Share and Enjoy:
  • Facebook
  • Digg
  • TwitThis
  • Sphinn
  • del.icio.us
  • Mixx
  • Google
  • MisterWong
  • StumbleUpon

If you enjoyed this post, make sure you subscribe to the RSS feed!

5 Comments

speak up

Add your comment below, or trackback from your own site.

Subscribe to these comments.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*Required Fields

nitai@sixsigns.com