Apache + Tomcat + ColdFusion + Java

Written on 20 March 2015, 09:24am

Tagged with: , , , ,

Below is a simple ColdFusion application architecture using Apache as web server and Tomcat as JEE application server.

1. Request workflow

Apache: In the Apache configuration file we have a virtual host <VirtualHost host1:80> with DocumentRoot /var/www/theColdFusionApp
Apache receives the request – example:
Hosts file: In /etc/hosts the host host1 is associated with the IP: host1
AJP module: If there is a non-CF request, Apache serves the request itself (ex. html, css, js, image). If there is a CFM request, the AJP module forwards it to Tomcat: ProxyPassMatch ^/(.*\.(cf[cm]|cfml))$ ajp://host1:8080/$1 (Apache config file)
Tomcat has an AJP connector on that port: <Connector port="8080" protocol="AJP/1.3"/>
and an engine to process the requests:

<Engine name="Catalina" defaultHost="host1">
 <Host name="host1"  appBase="webapps">
    <Context path="" docBase="/var/www/theColdFusionApp/"/>

Both entries above are in the Tomcat server.xml config file.
Application folders: In /var/www/theColdFusionApp we have both the CF files (WEB-INF and CFIDE folders) and the actual application folders. More details below.

2. Folder structure and configuration files


During my first half of the summer holidays, I took the opportunity to browse a few books in addition to reading my reader (which I am doing more or less daily). Doing this, I found a few things that influenced me and that I want to share.

1. Better than yesterday

The secret is to focus on making whatever it is you’re trying to improve
better today than it was yesterday. That’s it. It’s easy. And it’s possible
to be enthusiastic about taking real, tangible steps toward a distant goal.
book excerpt, PDF, 153KB

Where: The Passionate Programmer (2nd edition): Creating a Remarkable Career in Software Development by Chad Fowler.
Why: Because even if I have this principle embedded in my mind (see the first post of this blog: moving on to better things) and even if I used it successfully on multiple occasions – it’s always a good idea to highlight it.

2. Side projects

First, we love to complain about the type of work we get.
Whether assigned to us by a boss or work that we do for clients, we never
get to work on the cool stuff, the stuff that would inspire or excite us.
Second, we are full of bright ideas for the sites we work
on but are so often blocked by others on the project. We moan that they
don’t get it, that they don’t understand just how cool our ideas are.
I believe that side projects we do in our personal time
can be the answer to both of these issues.

Where: Side projects can cure our woes by Paul Boag.
Why: Because I agree with the importance of the side projects. In my free time, I am always working on at least one side project. Last example: the Ikea store locator

3. A long string of happy customers

The best thing for your career is a long string of happy customers
eager to recommend you because you did the right thing
by them and for the project. This goodwill will serve you orders
of magnitude better than the latest shiny object in the latest shiny
language or the latest shiny paradigm. While it is important, even
critical, to stay abreast of the latest trends and technologies this
should never happen at the cost of the customer.
-Chapter 1: Don’t Put Your Resume Ahead of the Requirements

Where: O’Reily’s 97 Things Every Software Architect Should Know – Collective Wisdom from the Experts by Richard Monson-Haefel
Why: Because I also see the importance of the happy customers.

4. Programmers have a lot on their minds

Programming languages, programming techniques, development
environments, coding style, tools, development process, deadlines,
meetings, software architecture, design patterns, team dynamics,
code, requirements, bugs, code quality. And more. A lot.

There is an art, craft, and science to programming that extends far
beyond the program. The act of programming marries the discrete world
of computers with the fluid world of human affairs. Programmers mediate
between the negotiated and uncertain truths of business and the crisp,
uncompromising domain of bits and bytes and higher constructed types.

Where: O’Reily’s 97 Things Every Programmer Should Know – Collective Wisdom from the Experts by Kevlin Henney (public wiki)
Why: Because the man is right 🙂 The programmers have indeed a lot on their minds…