Requirements    
Prerequisite knowledge
Required products
User level
  • Those using this tutorial should have a basic knowledge of ColdFusion and related application servers.
  • They should have a general understanding of the application server, web server, Tomcat, load balancing, clustering, and so forth.
  • They should be also be aware of the requirements of using the built-in web server in ColdFusion.
Adobe ColdFusion Enterprise Edition (2016 release) (Download trial)
Intermediate

 

This tutorial is ideal for people who want to get up to speed with using ColdFusion 10. As we all know, ColdFusion 9 was bundled with JRun as the J2EE application server. Going forward in ColdFusion 10, we have replaced JRun with Tomcat, which provides improved performance and reliability. While we have changed the underlying application server, there are few changes in the directory structure and in the underlying implementation. This tutorial addresses most of these points. This article also enables the user to become familiar with ColdFusion 10 very easily, making the migration from ColdFusion 9 extremely smooth. It is also extremely beneficial for new users who are interested in trying out ColdFusion.

 
Getting started

This section gives a brief introduction on getting started with using ColdFusion 10 using Tomcat as the built-in application server. You can download ColdFusion using the link at the beginning of this article in the Requirements section. The installation procedure is very similar to ColdFusion 9 procedure, which ensures user-friendly behavior.
Note : In this article, <ColdFusion_Home> refers to ColdFusion10/cfusion
 
Directory structure changes
There are a few directory changes to be aware of that are different from ColdFusion 9 to ColdFusion 10.
Table 1. Comparison of directory changes between ColdFusion 9 and ColdFusion 10
 
ColdFusion 9
ColdFusion 10
ColdFusion home
ColdFusion9
ColdFusion10\cfusion
Location of ColdFusion JRE
ColdFusion9\runtime\jre
ColdFusion10\jre
Location of jvm.config
ColdFusion9\runtime\bin\jvm.config
ColdFusion10\cfusion\bin\jvm.config
Location of connector-related files
ColdFusion9\runtime\lib\wsconfig
ColdFusion10\config\wsconfig
Location of uninstallation folder
ColdFusion9\uninstall
ColdFusion10\uninstall
Location of configuartion files for the underflying Application Server
ColdFusion9\runtime\servers\coldfusion\SERVER-INF\
ColdFusion10\cfusion\runtime\conf\
 
Starting, stopping, and restarting ColdFusion Server
You can start, stop, and restart ColdFusion from either the Windows services (on Windows) or from the command line(for any platform installation).
To start, stop, or restart ColdFusion from the console , go to the <ColdFusion_Home>\bin directory through the command prompt or the terminal.
  • To start ColdFusion:
On Windows: Use cfstart or coldfusion.exe –start –console
On Linux/MAC/Solaris: Use ./coldfusion start
  • To stop ColdFusion:
On Windows: Use cfstop or coldfusion.exe –stop
On Linux/MAC/Solaris: Use ./coldfusion stop
  • To restart ColdFusion:
On Windows: Use coldfusion.exe –restart –console
On Linux/MAC/Solaris: Use ./coldfusion restart
  • To find out the status of ColdFusion server:
On Windows: Use coldfusion.exe –status
On Linux: Use ./coldfusion –status
For more details, refer to the ColdFusion Help documentation.
 
Configuring connectors for different web servers
  • ColdFusion provides support to configure the connector to different web servers apart from the default web server.
  • To configure a connector, launch the wsconfig UI tool or use the wsconfig command line options available, which you can find in the folder <ColdFusion_Home>\runtime\bin.
  • Place the respective files related to the connectors in the ColdFusion10\config\wsconfig folder.
  • The different web servers that ColdFusion supports are noted in the following table.
Table 2. Platform support matrix
Operating systems
IIS
Apache 32-bit
Apache 64-bit
Sun Java Web Server 32-bit
Sun Java WebServer 64-bit
Windows 32-bit
Yes
Yes
NA
Yes
NA
Windows 64-bit
Yes
Yes
Yes
Yes
No
Linux 32-bit
No
Yes
NA
No
NA
Linux 64-bit
No
No
Yes
No
No
Solaris-64 bit
No
No
Yes
No
Yes
MAC-10.6 onwards
No
No
Yes
No
No
Note: Cross-combinations (64-bit Solaris does not support 32-bit Apache and 32-bit SunJWS) are not supported on non-windows platforms. ColdFusion 10 does not provide support for Oracle iPlanet web server.

 
Exploring ColdFusion 10

Well, most of you have the general idea of using ColdFusion using Tomcat as built-in application server. There might still be many questions, such as:
How to change the built-in web server port
How to disable directory browsing
How to change the default Web Root
and so forth…
This section explains with all of these advanced options possible with ColdFusion using Tomcat as the built-in application server.
Note : <ColdFusion_Home> refers to ColdFusion10\cfusion.
 
Changing the default in-built web server port
To change the default in-built web server port:
  1. Open the server.xml file located in the <ColdFusion_Home>\runtime\conf folder.
  2. Find the following connector block:
 
<!-- internal webserver end --> <Connector executor="tomcatThreadPool" maxThreads="50" port="8500" protocol="org.apache.coyote.http11.Http11Protocol" connectionTimeout="20000" redirectPort="8445" /> <!-- internal webserver end -->
  1. This is the connector block for the built-in web server. If it is not enabled through installer, uncomment this block to enable it later on.
  2. Restart the server.
Disabling directory browsing for the built-in web server in ColdFusion
To disable directory browsing for the in-built web server in ColdFusion, use the following steps:
  1. Go to <ColdFusion_Home>\runtime\conf\web.xml and search for listings where <servlet-class> is org.apache.catalina.servlets.DefaultServlet.
  2. Set the <param-value> of listings to false .
  3. Restart the server.
Setting custom error pages
To set custom error pages, use the following steps:
  1. Go to < ColdFusion_Home>\wwwroot\WEB-INF\web.xml and add:
 
<error-page> <error-code>404</error-code> <location>/error404.html</location> </error-page>
  1. Restart the server.
Changing the default web root from <ColdFusion_Home>\wwwroot
To change the default web root, use the following steps:
  1. Open the server.xml file, located in < ColdFusion_Home>\runtime\conf directory.
  2. Search for the <Context ..> line under the Host block. It is usually found at the end of the file. Uncomment the following code block:
 
<!-- <Context path="/" docBase="<cf_home>\wwwroot" WorkDir="<cf_home>\runtime\conf\Catalina\localhost\tmp" ></Context> -->
  1. Change the value of docBase from <cf_home>\wwwroot to the new web root location (for example: C:\new_web_root).
  2. In the WorkDir , replace <cf_home> with the location of < ColdFusion_Home> . (For instance, C:\ColdFusion10\cfusion.)
  3. Copy the WEB-INF and CFIDE folders from the existing ColdFusion web root to the new ColdFusion web root. Restart the server.
 
Adding a virtual directory for ColdFusion using the built-in Tomcat application server
To add the virtual directory for ColdFusion using the built-in Tomcat application server, use the following steps:
  1. Uncomment the <Context ..> line under the Host block in the server.xml file, which is in <cf_home>\runtime\conf.
  2. Replace <cf_home> with the absolute path to ColdFusion Home.
  3. To add a Virtual directory, use the aliases attribute, as follows:
 
<Context path="/" docBase="C:\ColdFusion10\cfusion\wwwroot" WorkDir="C:\ColdFusion10\cfusion\runtime\conf\Catalina\localhost\tmp" aliases="/VD=C:\newwebroot\VD"> </Context>
  1. Restart the server.
  2. You can provide multiple aliases in the following format: format aliases= "/aliasPath1=docBase1,/aliasPath2=docBase2" where aliasPathN must include a leading "/" and docBaseN must be an absolute path to a directory.
 
Default path of the directory that ColdFusion uses for temporary files
The default path of the directory that ColdFusion uses for temporary files is:
 
<ColdFusion_Home>\runtime\conf\Catalina\localhost\tmp
 
Changing the default path of the directory that ColdFusion uses for temporary files
To change the default path of the directory, use the following steps:
  1. Uncomment the <Context ..> line under Host block in the server.xml file present in <cf_home>\runtime\conf.
  2. Replace <cf_home> with absolute path to ColdFusion Home.
  3. Set the value of the WorkDir attribute with the absolute path to the new temp location:
 
<Context path="/" docBase="C:\ColdFusion10\cfusion\wwwroot" WorkDir="C:\newtmp" > </Context>
  1. Restart the server.
SES Support in ColdFusion
Tomcat does not support SES URLs by default, but ColdFusion stand-alone installation supports it. You can find the default SES URL pattern in the web.xml file present in <ColdFusion_Home>\wwwroot\WEB-INF\web.xml. The SES URL pattern is as follows:
 
<!-- begin SES --> <servlet-mapping id="coldfusion_mapping_6"> <servlet-name>CfmServlet</servlet-name> <url-pattern>*.cfml/*</url-pattern> </servlet-mapping> <servlet-mapping id="coldfusion_mapping_7"> <servlet-name>CfmServlet</servlet-name> <url-pattern>*.cfm/*</url-pattern> </servlet-mapping> <servlet-mapping id="coldfusion_mapping_8"> <servlet-name>CFCServlet</servlet-name> <url-pattern>*.cfc/*</url-pattern> </servlet-mapping> <!-- end SES -->
Note : If you have deployed ColdFusion10 as an EAR or WAR on Tomcat, and you want to enable SES URLs, add the code above to the Web.xml for Tomcat.

 
Logging mechanism in ColdFusion 10

Logging in ColdFusion 10 is almost similar to ColdFusion 9 with a few changes.
  • In case of ColdFusion 9, ColdFusion logged the console output into the coldfusion-out.log located in the C:\ColdFusion9\runtime\logs directory. ColdFusion 10 logs the console output to coldfusion-out.log located in <ColdFusion_Home>\logs directory.
  • ColdFusion 10 puts all the log files in the <ColdFusion_Home>\logs directory.
  • ColdFusion 10 logs errors occurring due to Tomcat into the coldfusion-error.log file.
  • ColdFusion 10 logs Tomcat metrics to metrics.log.
  • ColdFusion 10 continues to use exception.log, application.log, audit.log, and so forth as were present in ColdFusion 9.
 
Changing the log file settings
  • Specify log file settings in the neo-logging.xml, located in the <ColdFusion_Home>\lib directory.
  • The size of coldfusion-out.log and coldfusion-error.log is by default 20MB. You can change the size of the log in the neo-logging.xml file by changing the maxOutLogSize setting.
  • You can also change the maximum number of backups of coldfusion-out.log and coldfusion-error.log that ColdFusion takes during log rotation within the neo-logging.xml file. Change the maxOutFileBackup setting.
  • You can change the settings of the remaining files in the ColdFusion Administrator by going to the Debugging and Logging > Logging Settings section. Change the Maximum file size and Maximum number of Archives settings accordingly.
  • You can change the above settings even in the neo-logging.xml file by changing the maxFileSize and maxFileBackUp.

 
Multi-server management

In ColdFusion 9, there was a separate installer available for installing ColdFusion as a multi-server. But in ColdFusion 10, there is no separate installer. Instead, multi-server support is possible using the stand-alone installer itself. When you install ColdFusion as a stand-alone version, ColdFusion places all the folders such as bin, runtime, wwwroot, and so forth, under the directory cfusion , which is treated as an instance.
 
Instance manager
ColdFusion enables the creation of a local instance or a remote instance, which is necessary for multi-server management. Both of them are possible thorugh the ColdFusion Administrator.
To create a local instance, use the following steps:
  1. Log in to the ColdFusion Administrator. Go to the Enterprise Manager > Instance Manager section.
  2. Click the Add local instance option.
  3. Specify the necessary details.
  4. Click Submit. Once ColdFusion creates the instance, a link that redirects to the Instance Manager page becomes available. The instance created displays in the Instance Manager section, where you can start, stop, and restart it.
To create a remote instance, use the following steps:
  1. Log in to the ColdFusion Administrator. Go to the Enterprise Manager > Instance Manager section.
  2. Click the Register remote instance option.
  3. Specify the necessary details.
  4. Click submit. Once ColdFusion creates the instance, a link which redirects to the Instance Manager page becomes available. The instance created displays in the Instance Manager section, where you can start, stop, and restart it.
Note: For more details refer to the "Registering a remote instance" section of the ColdFusion Help documentation.

 
Cluster management

ColdFusion provides support for managing multiple servers within a cluster. This is a very useful feature that supports load balancing, ensures reliability, decreases the execution time thereby improving performance. It is extremely simple to manage clusters in ColdFusion, and you can do it through the ColdFusion Administrator.
 
Adding local instances to the cluster
To add local instances to the cluster, use the following steps:
  1. Log in to the ColdFusion Administrator. Go to the Enterprise Manager > Cluster Manager section.
  2. Create a new cluster and add the required instances.
  3. Deselect the sticky sessions option if you need to enable session replication.
  4. Click Submit.
  5. Restart the instances in the cluster for the necessary changes to take place.
 
Adding remote instance to the cluster
To add a remote instance to a cluster, add the cluster block to the remote instance's server.xml file. Then, register the remote instance and add the instance to the cluster. For more information on configuring clusters on Tomcat, refer to this page. Use the following steps to add a remote instance to a cluster:
  1. Register the remote instance to local machine.
  2. Create a cluster in the local machine.
  3. Open the cf_install_dir\instance-name\runtime\conf\server.xml file of the remote instance.
  4. Add the following block between the entries </host> and </engine> :
 
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster" channelSendOptions="8"> <Manager notifyListenersOnReplication="true" expireSessionsOnShutdown="false" className="org.apache.catalina.ha.session.DeltaManager"> </Manager> <Channel className="org.apache.catalina.tribes.group.GroupChannel"> <Membership port="45565" dropTime="3000" address="228.0.0.4" className="org.apache.catalina.tribes.membership.McastService" frequency="500"> </Membership> <Receiver port="4003" autoBind="100" address="auto" selectorTimeout="5000" maxThreads="6" className="org.apache.catalina.tribes.transport.nio.NioReceiver"> </Receiver> <Sender className="org.apache.catalina.tribes.transport.ReplicationTransmitter"> <Transport className="org.apache.catalina.tribes.transport.nio.PooledParallelSender"> </Transport> </Sender> <Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector"> </Interceptor> <Interceptor className="org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor"> </Interceptor> </Channel> <Valve className="org.apache.catalina.ha.tcp.ReplicationValve" filter=""> </Valve> <Valve className="org.apache.catalina.ha.session.JvmRouteBinderValve"> </Valve> <ClusterListener className="org.apache.catalina.ha.session.JvmRouteSessionIDBinderListener"> </ClusterListener> <ClusterListener className="org.apache.catalina.ha.session.ClusterSessionListener”> </ClusterListener> </Cluster>
  1. In the entry above, update the membership port with the multicast port of the cluster.
  2. Using ColdFusion administrator of the local host, add the local instance and the remote instance to the cluster.
Note: If you enable sticky sessions, the JVM route of the remote instance and local instance must not be the same.
  1. Restart all of the instances.

 
Where to go from here

This tutorial addresses most of the points required for one to get started with ColdFusion 10 using Tomcat as built-in Application server. To learn more about what's new and enhanced in ColdFusion refer to the ColdFusion documentation and articles on the ColdFusion Developer Connection. Also see the document, What's new in ColdFusion 10. To learn more about Tomcat, see this document.