One of the biggest change in ColdFusion 10 is the replacement of underlying application server i.e JRun with Tomcat. There have been a lot of questions and discussions on Tomcat in ColdFusion 10 on various forums and blogs and I will try to address some of them in this post.
Is the inbuilt server in ColdFusion 10 a modified version of Tomcat? If yes, what are the changes and why?
Yes, the in-built server in ColdFusion 10 is a modified version of Tomcat. When we started out, we didn’t envision making any changes in Tomcat, but soon we realized that people would need seamless experience when they move from ColdFusion 9 or a previous version to ColdFusion 10. That meant that the directory structure, the features, connector experience - all need to be as close to previous versions (JRun as inbuilt server) as possible. Some of the important changes that we had to make in Tomcat are
- The directory structure - When you install Tomcat separately, its directory structure would be quite different from the directory structure that ColdFusion has. We have ensured that people don’t find themselves in a completely unfamiliar installation structure. So the launcher that launches ColdFusion (actually Tomcat), the way you configure the JVM for Tomcat (jvm.config), the default wwwroot, the directory structure for the entire installation etc. are almost identical to any previous ColdFusion installation.
- SES URL support : Tomcat does not support SES (Search Engine Safe) urls out of the box. Since a lot of ColdFusion customers are used to this kind of URL in their application, this was a very important change required in Tomcat.
- Web server connectors : Tomcat does come with connectors for webservers like IIS/Apache, however it has far less features as compared to the JRun connector. We have tried to bridge the gap as far as possible so that you, as a user of ColdFusion, do not lose the features that you have been using. Some of the changes we had to make for connector are
- Multiple webroot support : Tomcat serves the files only from its application root. That means that the only way for Tomcat to serve the files from IIS/Apache webroot is to configure IIS/Apache webroot as the Tomcat's application root. But that way, it will not serve any file from Tomcat's webroot. ColdFusion always had these two decoupled and supported both the webroots at the same time. So we made changes in Tomcat to retain the old behavior. In fact ColdFusion falls back to its wwwroot for searching a file if it can't be found by IIS/Apache.
- CGI scope variables : A lot of CGI scope variables were not available with original Tomcat connector because the Tomcat connector did not had any way to query the webserver. We made changes to ensure that your application does not break.
- ColdFusion session replication in cluster : If one is not using sticky session in a cluster, it is extremely important to have session replication to ensure that your application works smoothly in a cluster. We had to make some changes in Tomcat to enable the replication of ColdFusion session because of certain classloading issues.
Does that mean that ColdFusion will not run and will not be supported on a standard Tomcat installation?
ColdFusion will definitely run and will be supported on standard Tomcat installation like any other JEE server deployment. As ColdFusion's support on any other JEE server, the deployment will use the inbuilt web server of Tomcat and therefore the 3rd point listed above about web server connectors will not come into play at all. You can definitely use the web server connector provided by Tomcat but like any other JEE server support, since ColdFusion does not provide the connector, we will not be able to provide any support if there are any issues with the connector.
OK.. but, SES URL is still an issue with plain Vanilla Tomcat, right? Yes and No. By default, Tomcat does not allow the SES URL the way JRun or other JEE servers do. Below is a snippet from the web.xml and as you can see, we have defined the URL pattern as "*.cfm/*" and "*.cfc/*".
<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>
However, in Tomcat, to get SES URL to work, you would need to put the exact URL till .cfm/.cfc in the web.xml like the snippet below
<servlet-mapping id="mapping1"> <servlet-name>CfmServlet</servlet-name> <url-pattern>/index.cfm/*</url-pattern> </servlet-mapping> <servlet-mapping id="mapping2"> <servlet-name>CfmServlet</servlet-name> <url-pattern>/foo.cfm/*</url-pattern> </servlet-mapping> <servlet-mapping id="mapping3"> <servlet-name>CfmServlet</servlet-name> <url-pattern>/app1/index.cfm/*</url-pattern> </servlet-mapping> <servlet-mapping id="mapping3"> <servlet-name>CfmServlet</servlet-name> <url-pattern>/app1/bar/foo.cfm/*</url-pattern> </servlet-mapping>
You get the idea.. I know that’s a little painful to add all the URLs of your application in the web.xml but that’s the way to go if you want to use SES URL in plain vanilla Tomcat.
Can I deploy my own application (war/ear) on an instance created by instance Manager?
Unfortunately no. The directory structure change also meant that in the ColdFusion standalone installation, one would not be able to deploy any other application (ear/war). This is how the standalone installations of earlier versions of ColdFusion used to behave as well.
The multi-server installation of ColdFusion 9 and earlier used to lay down plain app server and then deploy ColdFusion as one of the application. This allowed you to install any other application (ear/war) as well on any instance. However, with ColdFusion 10, when you create an instance from the instance manager, it is a replication of the main default instance of standalone installation and therefore you cant deploy any other application (war/ear) on any instance.
That’s all good, but how do I upgrade the in-built Tomcat, in case Tomcat comes out with a critical fix or a security fix?
Well, ColdFusion 10 now has an amazing delivery mechanism with hotfix notification and installer. We will use the same infrastructure to keep the Tomcat engine updated. CF-Tomcat update should be available soon after Tomcat comes out with any critical fix. We will also make the same available for you to download and use.
I hope I have covered most of the questions that you all have raised. Now let the comments pour in!