What’s the deal with Tomcat in ColdFusion 10?
"Adobe ColdFusion" · "Adobe ColdFusion 10" · "Application Server"
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.
What if I want best of both - i.e ColdFusion's version of Tomcat that allows deployment of any application?
We will make ColdFusion's modified version of Tomcat (let's call it CF-Tomcat) as well as the connectors available for you, so that you can use it like a standard Tomcat installation. This will allow you to take advantage of all the changes that we have made in Tomcat and at the same time, you can deploy any application on it the way you want. We are also exploring the option of open-sourcing the changes that we have made in Tomcat.
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!
ColdFusion WebSockets Use case: Video over WebSockets
"Adobe ColdFusion 10" · "Rapid Application Development" · "web application development"
ColdFusion WebSockets are lightning fast and presents an opportunity to create realtime applications. This time I've created an application that tries to push HTML5 video content over a WebSocket. The idea here is to use a temporary Canvas, since it allows you to draw a video frame on it and then transfer the contents of the drawn video frame (as base64 encoded Image) over a ColdFusion WebSocket channel to the subscribers.
I've posted this on my blog along with the demo video and code. Check out Pushing HTML5 Video content over ColdFusion WebSockets.
Co-existence of ColdFusion9 and ColdFusion10 using Apache web server
With ColdFusion10 Beta already out, many of us will be wondering if there is any way ColdFusion9 and ColdFusion10 can co-exist by using any of the Web Servers available. The answer is yes, it is definitely possible. The next question which will arise is "how can it be achieved?". Well.. It can be achieved very easily by performing a few steps. The detailed explanation can be found in my blog entry here
Troubleshooting with JBoss 7
"Adobe ColdFusion" · "Adobe ColdFusion 10" · "Application Server"
- JBoss & Cookie Expiry : With JBoss 6 and 7, cookies by default specify the expiration time of cookie as "Max-Age" header attribute instead of "Expires". I have written a detail about this here.
- Random number generation and server start up is slow on Unix platforms for some of the servers. This is because of /dev/random is used in Unix platforms for random number generation. I have added a detail entry explaining the problem and solution here.
-
JBoss 7 AS, has modular class loading. It provides true application isolation, hiding server implementation classes from application and only loading the classes your application needs. Modules, packaged as collections of classes, are peers that remain isolated unless explicitly defined as a dependency of another module. These visibility rules can be customized.Due to this design, JBoss modules does not load everything from rt.jar and many other system jars by default. As a result you may get ClassNotFoundException or NoClassDefFounfError for a lot of classes. Read here for solution and workarounds available for this.
Hot-Fix Installer
"Adobe ColdFusion 10" · "productivity" · "Rapid Application Development" · "web application development" · "web application security"
How many times you have wished there was a simpler way to apply hot-fixes? How many times number of steps involved have caused inconvenience and errors in deployment? The debugging required in most of these cases really takes a long time. Same is true for uninstalling a particular hot-fix.
With ColdFusion 10, all of this will be solved and hot-fix installation will becomes a one click activity. Hot-fix installer (updater) is bundled within ColdFusion 10. This will eliminate the hassles of copying files, deleting files, different hot-fixes like cumulative, security etc. There will be always a single cumulative hoti-fix available. Hot-fix installer will take care of all the work required to update the server and will also keep the back up.
Read my blog here to know details about this feature.