15 May 2012
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.
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
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 |
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\ |
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.
On Windows: Use cfstart or coldfusion.exe –start –console
On Linux/MAC/Solaris: Use ./coldfusion start
On Windows: Use cfstop or coldfusion.exe –stop
On Linux/MAC/Solaris: Use ./coldfusion stop
On Windows: Use coldfusion.exe –restart –console
On Linux/MAC/Solaris: Use ./coldfusion restart
On Windows: Use coldfusion.exe –status
On Linux: Use ./coldfusion –status
For more details, refer to the ColdFusion Help documentation.
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.
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.
To change the default in-built web server port:
<!-- internal webserver end -->
<Connector executor="tomcatThreadPool" maxThreads="50" port="8500" protocol="org.apache.coyote.http11.Http11Protocol" connectionTimeout="20000"
redirectPort="8445" />
<!-- internal webserver end -->
To disable directory browsing for the in-built web server in ColdFusion, use the following steps:
<servlet-class> is org.apache.catalina.servlets.DefaultServlet.<param-value> of listings to false .To set custom error pages, use the following steps:
< ColdFusion_Home>\wwwroot\WEB-INF\web.xml and add: <error-page>
<error-code>404</error-code>
<location>/error404.html</location>
</error-page>
<ColdFusion_Home>\wwwrootTo change the default web root, use the following steps:
< ColdFusion_Home>\runtime\conf directory.<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> -->
docBase from <cf_home>\wwwroot to the new web root location (for example: C:\new_web_root).WorkDir , replace <cf_home> with the location of < ColdFusion_Home> . (For instance, C:\ColdFusion10\cfusion.)To add the virtual directory for ColdFusion using the built-in Tomcat application server, use the following steps:
<Context ..> line under the Host block in the server.xml file, which is in <cf_home>\runtime\conf.<cf_home> with the absolute path to ColdFusion Home.<Context path="/" docBase="C:\ColdFusion10\cfusion\wwwroot" WorkDir="C:\ColdFusion10\cfusion\runtime\conf\Catalina\localhost\tmp" aliases="/VD=C:\newwebroot\VD">
</Context>
format aliases= "/aliasPath1=docBase1,/aliasPath2=docBase2" where aliasPathN must include a leading "/" and docBaseN must be an absolute path to a directory.The default path of the directory that ColdFusion uses for temporary files is:
<ColdFusion_Home>\runtime\conf\Catalina\localhost\tmp
To change the default path of the directory, use the following steps:
<Context ..> line under Host block in the server.xml file present in <cf_home>\runtime\conf.<cf_home> with absolute path to ColdFusion Home.WorkDir attribute with the absolute path to the new temp location:<Context path="/" docBase="C:\ColdFusion10\cfusion\wwwroot" WorkDir="C:\newtmp" >
</Context>
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 in ColdFusion 10 is almost similar to ColdFusion 9 with a few changes.
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.coldfusion-out.log and coldfusion-error.log that ColdFusion takes during log rotation within the neo-logging.xml file. Change the maxOutFileBackup setting.neo-logging.xml file by changing the maxFileSize and maxFileBackUp.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.
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:
To create a remote instance, use the following steps:
Note: For more details refer to the "Registering a remote instance" section of the ColdFusion Help documentation.
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.
To add local instances to the cluster, use the following steps:
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:
</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>
Note: If you enable sticky sessions, the JVM route of the remote instance and local instance must not be the same.
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.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License
Tutorials & Samples |