The World's Favorite Open Source GPL J2EE CFML Runtime Engine

BlueDragon Developer's Journal

Subscribe to BlueDragon Developer's Journal: eMailAlertsEmail Alerts newslettersWeekly Newsletters
Get BlueDragon Developer's Journal: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn

Open BlueDragon Authors: Reuven Cohen, Elizabeth White, Michael Sheehan, John Gauntt, Salvatore Genovese

Related Topics: Open BlueDragon Developer's Journal, ColdFusion on Ulitzer, Java EE Journal

BlueDragon: Article

Isn't It About Time to Dump CF5?

Going from CF5 to CFMX7

A new project just landed on my desk. This is not a maintenance project; it's brand new, start from scratch, development. The client asked me to build a site in ColdFusion 5. It's my fourth project in the past year that's based on a legacy version of CF. I could have saved the client both time and money by building it in CFMX, since I have a lot of the functionality pre-built as ColdFusion Components. But CFCs don't work in CF5, so those pre-built components are pretty useless. There's no better time to upgrade than right now; in this article I thought I'd show you the process I'd take when upgrading a server from CF5 to CFMX7.

The Upgrade
There are compelling reasons to get off CF5. For developers, it's the use of CFCs that let you build more maintainable code. For business folk, it's support. It's harder to find CF5-based developers and I suspect that when CFMX8 comes out, support for CF5 will drop. If they follow an 18-month release schedule, then I'm sure it will happen within the next year. Other niceties like PDF generation and event gateways make the upgrade more appealing. So let me step you through the process.

First download the latest version of ColdFusion. You can do so from the Adobe Web site. The J2EE version is a slightly different beast so I'll just step you through the standard install. It's closest to the CF5 installation. The J2EE version, if you already have a J2EE server, can create multiple isolated ColdFusion instances. This is great if you have to isolate apps from each other, but I don't usually use this. You can get the same functionality from the multi-server install (and it's easier to manage).

Launch the install program, and follow these steps:

  1. Select your language and click Okay. Read the introduction note. There are no decisions to make on this screen so click Next. Read through the license agreement and select "I agree" then click Next. These were the easy steps.
  2. Enter your license number or select the trial/developer edition. For this example, the developer edition is okay. Select it, and click Next.
  3. This screen in Figure 1 lets you select which version to install. I've already mentioned versions, but you can read more details about them in the livedocs at Select "server" and click Next.
  4. This screen lets you select the sub-components you want to install. There are three options, the documentation, the search services, and the ODBC services. I won't install the tutorials or documentation on a production server, but I usually keep the other two. On a dev server I usually install it all. Click Next.
  5. Select the directory that you want to install to. I usually keep the default. Click Next.
  6. A previous version was detected, as shown in Figure 2. You can use the built in the Web server or reconfigure the existing Web server. We want to reconfigure. Click Next. The installer will detect your Web server. You're given the option of configuring multiple Web sites. On Windows XP, IIS doesn't let you have multiple Web sites, so select Update All and click Next. Enter your Web root and click Next.
  7. Enter the password for the ColdFusion Administrator. Click Next and enter the password for RDS. Click Next.
  8. You'll get a summary of the install options, as shown in Figure 3. Review them and click Install. ColdFusion will start installing. Go top off your drink of the day (coffee, water, or vodka).
  9. When you come back, CF should be installed.
Now that ColdFusion is installed, you have to configure it. This happens the first time you open the ColdFusion Administrator, or you could select the checkbox on the final install screen to do the configuration manually. Click Done (and check the box) to enter the configuration wizard, as shown in Figure 4.
  1. Enter your ColdFusion Administrator password and click Login.
  2. ColdFusion will chug for a bit and then give you the option of migrating your settings. You probably want to do this, so click Next. If you want to start CFMX new and configure it as needed you can skip this.
  3. You'll see a list of items that can be migrated. Datasources, verity collections, and mappings are just some of them. Click Next.
  4. ColdFusion will chug some more. It will let you know if there are any problems. Click Next to start the migration.
  5. Once again, the setup wizard chugs and lets you know that things were done. Click Ok to open the Getting Started experience (if you installed he samples / documentation).
The Code Analyzer
Before upgrading a production machine, you might want to test your apps on a development machine first. I strongly recommend it, especially when moving from ColdFusion 5 to ColdFusion MX. ColdFusion 5 was built on a C++ architecture, whereas CFMX is on top of J2EE. These changes in underlying structure introduced a few oddities to the language. Most of your code will work without a problem, and there are many upgrade success stories. But, for those few gotchas it's good to test. To help alleviate the migration problem, the ColdFusion administrator includes a code analyzer. It will examine your code and help isolate problems or potential problems. (The code analyzer also helps if you're just upgrading from CFMX to CFMX7, although you're less likely to have serious issues). Once ColdFusion's installed, launch the administrator and sign in. Select Code Analyzer under the "Debugging and Logging" menu. You'll see a screen like Figure 5.

Enter the name of your directory, the type of files to analyze, and click the run analyzer option. For the file types, most likely you'll be analyzing cfm files and therefore want to use the default "*.cfm" as the type. If you've used some tricks on the Web server to make ColdFusion process files with alternate extensions such as HTML then you'll want to add those extensions here. Click the advanced options feature, and you'll see Figure 6. This lets you specify which tags, functions, or issues to look for in your code. Normally, I'd just use the basic option, but if you need this kind of granular control it's there.

Click Run Analyzer and you should a list similar to Figure 7. (Or maybe you code perfectly and get nothing returned.) You can sort the listing by clicking on the column headers. Click the first icon to see a detailed report of the errors. Click on the second to see a file specific.

I don't recommend using the code analyzer as a substitute for doing quality assurance tests on your apps, but it's a good starting point to figure out what areas may need code changes.

Here are some of the most common issues I've faced when upgrading:

  • Security Model: The security model changed in moving off the C code base. Many tags and functions related to the CF5 way of doing things have been rendered obsolete. Tags such as cfauthenticate and cfimpersonate are gone. Functions such as isAuthorized, isAuthenticated, and AuthenticatedUser are gone. Take a look at cflogin and cfloginuser for information on ColdFusion's new security features. (You didn't use that old security framework anyway, did you?)
  • Monitor Errors: CF5 had an error type for the cferror called monitor. Monitor was so you could follow specific error types. It trumped cftry / cfcatch blocks. This kind of error handling is gone.
  • Graphing: cfgraph and cfgraphdata are gone. Instead look at cfchart, cfhartdata, and cfhartseries.
  • Dynamic Database Access: ColdFusion 5 lets you use connections strings to connect to the database. This was useful in many cases, especially shared hosting environments and preventing other people on your server from guessing your DSN and getting access to all of your data. Connection strings were added to, but with ColdFusion the best you're going to get is a security sandbox that restricts database access.
  • Registry Access: The cfregistry tag no longer works on Unix machines. Unix doesn't have a registry in the same way that ColdFusion does; so that's not a surprise.
  • Periods in the Variable Name: In CF5, the period was valid in a variable name. In CFMX, a structure will be created. The text before the period will be the structure name and the text after the period will be the key. This is called dot notation and is similar to how you access many values in CF, such the results of a query set.
  • ODBC: This is more of a configuration issue than a coding issue. In CF5, ColdFusion could access datasources created in the ODBC control panel by default. Since CFMX is Java-based, it uses JDBC instead of ODBC. You can access control panel databases uses an ODBC bridge, or connect to the database directly using the JDBC drivers included.
There's some documentation included with CFMX6 that talks about migrating from 5 to MX. It's worth a read since it goes into more depth than this article. Check it out at Migrating_ColdFusion_5_Applications/cf_migration_guide.htm.

Final Thoughts
It seems weird to be writing about this so long after the initial release of CFMX. I look forward to the day when I can remove CF5 from my machine and clients will stop asking me for version 5-compatible code (I've started turning down requests for 4.5 development). Until then, I keep ColdFusion 5, ColdFusion MX, and BlueDragon running side-by-side. This is beneficial when it comes to migrating apps between versions or testing code for cross-version compatibility. I described this set up in an article I co-wrote with Charlie Arehart at Although it's a bit dated, all the techniques still apply.

More Stories By Jeffry Houser

Jeffry is a technical entrepreneur with over 10 years of making the web work for you. Lately Jeffry has been cooped up in his cave building the first in a line of easy to use interface components for Flex Developers at . He has a Computer Science degree from the days before business met the Internet and owns DotComIt, an Adobe Solutions Partner specializing in Rich Internet Applications. Jeffry is an Adobe Community Expert and produces The Flex Show, a podcast that includes expert interviews and screencast tutorials. Jeffry is also co-manager of the Hartford CT Adobe User Group, author of three ColdFusion books and over 30 articles, and has spoken at various events all over the US. In his spare time he is a musician, old school adventure game aficionado, and recording engineer. He also owns a Wii. You can read his blog at, check out his podcast at or check out his company at

Comments (2)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.