Missing Components After Moving a ColdFusion Site

Adobe ColdFusion logo

Last week I was tasked with moving several of my applications from one CF 8 server to another one, due to the first server’s VM host having some kind of problem requiring daily restarts of the VM by our infrastructure team.

After moving two applications, the users began complaining that one of the functions in one of the applications that had previously worked perfectly was not working at all for some users now.

IE 11 Developer Tools window
IE 11 Developer Tools window showing debugger options

By opening Developer Tools in Internet Explorer (this is not a Chrome-compatible application), and setting the “Break on all exceptions” option in the debugger, I was able to begin troubleshooting the problem.

The exceptions in JavaScript that were being thrown dealt with missing classes, including declared ColdFusion components and ColdFusion.Ajax functions.

I remembered at that point that I had forgotten to do something that all ColdFusion developers should do on each application: to create the CFIDE virtual directory in IIS.

Once this simple task was done, everything worked as expected.

Changes in the ColdFusion.window.create Function Require a Modern Browser

error dialog box

I’m still working on upgrading some older CF8 applications to CF11. I came across an interesting problem, the exact cause of which I have not found, but I do have a solution of sorts.

When the particular application I’m working on now was written, the standard browser that would be accessing it was Internet Explorer 8. Over time, as we have upgraded our browsers, but not had time to make changes to the application to accommodate those new browsers, we had used the dreaded Compatibility View to keep the look and feel of the application unchanged.

Since we are now several versions out from CF8, it is understandable that some things intrinsic to ColdFusion have changed. Somehow, the way that the function ColdFusion.window.create renders JavaScript to create the pop-up window does not work with IE 8 or a newer browser emulating IE 8 (as we forced with the X-UA-Compatible HTTP header in IIS). After copying the website to the CF11 server, setting up everything in IIS, and navigating to the website, everything was great until I clicked on a link that executed a function (named “createCFWindow”, as in the dialog box below) that called the ColdFusion.window.create function.

This is the result:

error dialog box

After stepping through the code using Internet Explorer’s Developer Tools, I determined that the reason this “createCFWindow” function threw an exception was because the ColdFusion.window.create function was returning null rather than a new window.

When testing the website on Chrome – which this application was not designed to use – I discovered that the error did not occur, and decided to turn off Compatibility View. Sure enough, this error disappeared in IE 11 – though a host of other issues have now developed.

Now, I’m working to upgrade the application to be HTML5-compliant so it will work on IE 11 or Chrome.

Apparently, using CF UI tags became unfashionable quite some time ago, but that type of advice isn’t always heard or heeded until long after it’s announced.

Any future applications I build will use jQuery instead for this sort of thing.

Errors Related to the Use of CFAJAX Tags in ColdFusion

Adobe ColdFusion logo

This is a quick change that is easily missed when adding AJAX functionality to an old ColdFusion site with CFAJAX tags. In my case, I was adding this functionality to a site that had originally been developed about ten years ago. This site runs on a Windows server with IIS.

After getting the site upgraded and working properly in the dev and test environments, I discovered that several errors were happening in prod that never happened in test or dev. The most common of these errors was “ColdFusion is undefined”.

Of all things, the Virtual Directory to CFIDE had never been created. As is so common, major problems can be caused by tiny bugs in code, or in this case, in the Web server configuration itself.

Create a Virtual Directory in the root of the website and name it CFIDE. It should, in most cases, point to C:\inetpub\wwwroot\CFIDE. Once this is done, the CFAJAX errors should be no more!

UPDATE via Gavin Pickin (@gpickin):