Apache + Tomcat + ColdFusion + Java
Written on 20 March 2015, 09:24am
Tagged with: apache, architecture, coldfusion, tomcat, tutorial
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: http://123.45.67.89:80.
Hosts file: In /etc/hosts
the host host1
is associated with the IP: 123.45.67.89 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/"/>
</Host>
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
/var/www/theColdFusionApp
/CFIDE/
/administrator/
/WEB-INF/
/cfusion/lib/neo-*.xml
/web.xml
/META-INF/
/CSS/
/JS/
/IMG/
*.cfm
/opt/tomcat/
/conf/
/server.xml
/logs/
/etc/httpd/conf.d/host1.conf
/etc/hosts
Line 5: the WEB-INF/cfusion/lib
folder contains the ColdFusion configuration files. Basically this is where ColdFusion saves its settings when you make modifications in CF Admin. Some of the important files are neo-datasource.xml
and neo-runtime.xml
(contains the custom tag locations, the mappings, cfx extensions, etc)
Line 6: the file WEB-INF/web.xml
contains some configuration settings shared between CF and Tomcat. One of the most important is the cf.class.path
Line 14: server.xml
is the main Tomcat configuration file
3. Troubleshooting
Permissions: make sure that the scripts in /opt/tomcat/bin/
are executable (chmod +x *.sh
)
Compatibility: make sure that the ColdFusion version is compatible with Tomcat and Java versions (java -version
). For instance, CF11 is not working with Tomcat 8 at the moment.
Clean up Tomcat folder: if Tomcat fails to start or times out, make sure that you clean up the following Tomcat folders: /opt/tomcat/webapp
, /opt/tomcat/work/Catalina
, /opt/tomcat/conf/Catalina
Restart: in my case it happened that the Tomcat startup process hung up at the step Starting security...
. I didn’t find the exact cause for this, but the workaround was to restart the machine.
Log files: You should watch the following log files:
/opt/tomcat/logs/catalina.out
/var/www/theColdFusionApp/WEB-INF/cfusion/logs/*
/var/log/httpd/*
A clean Tomcat startup should look in catalina.out
like below. You will know when things are up and running when you’ll see the message ColdFusion: application services are now available (line 50 below) 🙂
Good luck!
Mar 19, 2015 1:03:08 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8101"]
Mar 19, 2015 1:03:08 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 9864 ms
Mar 19, 2015 1:03:08 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Mar 19, 2015 1:03:08 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.59
Mar 19, 2015 1:03:18 PM org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
INFO: Creation of TestRandom instance for session ID generation using [SHA1PRNG] took [277] milliseconds.
03/19 13:03:41 INFO License Service: Flex 1.5 CF Edition enabled
03/19 13:03:41 INFO Starting Flex 1.5 CF Edition
Mar 19, 2015 1:03:42 PM org.apache.catalina.core.ApplicationContext log
INFO: ColdFusionStartUpServlet: ColdFusion: Starting application services
Mar 19, 2015 1:03:42 PM org.apache.catalina.core.ApplicationContext log
INFO: ColdFusionStartUpServlet: ColdFusion: VM version = 25.31-b07
Mar 19, 2015 13:03:43 PM Information [secure-startStop-1] - Starting logging...
Mar 19, 2015 13:03:43 PM Information [secure-startStop-1] - Starting license...
Mar 19, 2015 13:03:44 PM Information [secure-startStop-1] - Evaluation Edition enabled
Mar 19, 2015 13:03:44 PM Information [secure-startStop-1] - Starting crypto...
Mar 19, 2015 13:03:45 PM Information [secure-startStop-1] - Installed JSafe JCE provider: Version 6.0 Crypto-J 6.0, EMC Corporation.
Mar 19, 2015 13:03:45 PM Information [secure-startStop-1] - Starting security...
Mar 19, 2015 13:03:48 PM Information [secure-startStop-1] - Starting scheduler...
Mar 19, 2015 13:03:48 PM Information [secure-startStop-1] - Starting WatchService...
Mar 19, 2015 13:03:48 PM Information [secure-startStop-1] - Starting debugging...
Mar 19, 2015 13:03:48 PM Information [secure-startStop-1] - Starting sql...
Mar 19, 2015 13:03:49 PM Information [secure-startStop-1] - Pool Manager Started
Mar 19, 2015 13:03:49 PM Information [secure-startStop-1] - Starting mail...
Mar 19, 2015 13:03:49 PM Information [secure-startStop-1] - Starting runtime...
Mar 19, 2015 13:03:53 PM Information [secure-startStop-1] - CORBA Configuration not enabled
Mar 19, 2015 13:03:53 PM Information [secure-startStop-1] - Starting cron...
Mar 19, 2015 13:03:53 PM Information [secure-startStop-1] - Starting registry...
Mar 19, 2015 13:03:53 PM Information [secure-startStop-1] - Starting client...
Mar 19, 2015 13:03:54 PM Information [secure-startStop-1] - The metrics service is disabled for the J2EE edition
Mar 19, 2015 13:03:54 PM Information [secure-startStop-1] - Starting xmlrpc...
Mar 19, 2015 13:03:55 PM Information [secure-startStop-1] - Starting jaxrs...
Mar 19, 2015 13:03:55 PM Information [secure-startStop-1] - Starting graphing...
Mar 19, 2015 13:03:55 PM Information [secure-startStop-1] - Starting solr...
Mar 19, 2015 13:03:55 PM Information [secure-startStop-1] - Starting archive...
Mar 19, 2015 13:03:55 PM Information [secure-startStop-1] - Starting document...
Mar 19, 2015 13:03:56 PM Information [secure-startStop-1] - Starting eventgateway...
Mar 19, 2015 13:03:56 PM Information [secure-startStop-1] - Event Gateway Disabled.
Mar 19, 2015 13:03:56 PM Information [secure-startStop-1] - Starting FlexAssembler...
Mar 19, 2015 13:03:56 PM Information [secure-startStop-1] - Starting .NET...
Mar 19, 2015 13:03:56 PM Information [secure-startStop-1] - Starting Monitoring...
Mar 19, 2015 13:03:57 PM Information [secure-startStop-1] - Starting Monitoring Server on port 5500.
Mar 19, 2015 13:03:58 PM Information [secure-startStop-1] - Starting WebSocket...
Mar 19, 2015 13:04:00 PM Information [secure-startStop-1] - WebSocket server listens on port: 8577
Mar 19, 2015 13:04:01 PM Information [secure-startStop-1] - ColdFusion started
Mar 19, 2015 13:04:01 PM Information [secure-startStop-1] - ColdFusion: application services are now available
Mar 19, 2015 1:04:02 PM org.apache.catalina.core.ApplicationContext log
INFO: CFMxmlServlet: Macromedia Flex Build: 87315.134646
03/19 13:04:02 INFO Macromedia Flex Build: 87315.134646
Mar 19, 2015 1:04:16 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8101"]
Mar 19, 2015 1:04:16 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 67589 ms
Written by Dorin Moise (Published articles: 277)
- Likes (1)
-
Share
- Comments (1)
Comments (1)
Nice article. Do you have similar Arch. with ColdFusion11 ? Also, any help managing the JAVA Memory & GC.
Thanks