CommandBox, the previous lesson, covers running an application locally. This lesson closes out Module 17 with getting it onto a real server, Adobe ColdFusion's own tooling for packaging and moving an application between environments.
Learning Objectives
After completing this lesson, you'll be able to:
- Package and deploy a ColdFusion Archive (CAR) file through the ColdFusion Administrator.
- Know what CAR deployment doesn't carry over, and why that matters before relying on it.
- Recognize when a JEE EAR/WAR archive is the right deployment format instead.
- Use cfcompile to precompile an application for a sourceless distribution.
How Deploying a CAR File Fits Together
Create an Archive Definition
choose what to package
Build the CAR File
directories, mappings, settings
Deploy to the Target Server
restore the contents there
Fix Up Datasources/Mappings
paths rarely match exactly
ColdFusion Archive (CAR) Files
CAR files are managed under Packaging & Deployment > ColdFusion Archives in the ColdFusion Administrator, and the process has three phases.
| Phase | Does |
|---|---|
| Create the archive definition | Choose what to include, almost anything about the site: directories, files, CFX tags, ColdFusion mappings, Solr collections, scheduled tasks, server settings. Each definition gets a unique name |
| Build the archive | Select the definition and specify where to write the resulting CAR file |
| Deploy the archive | Specify the CAR file's location and where to restore its contents |
A Real Gotcha: What CAR Deployment Doesn't Carry Over
Adobe's own documentation is explicit about two real limitations. ColdFusion does not deploy Administrator and RDS passwords, those have to be set manually on the target server. It also doesn't unpack archives created in an earlier ColdFusion version, a CAR file isn't a universal format across versions.
There's a narrower gotcha too: directory translation doesn't happen automatically for datasources using MS Access, Derby, or other path-based drivers. Either edit those datasources manually in the Administrator after deploying, or edit server_setting.xml directly to fix the paths.
JEE Archives (EAR/WAR)
For a JEE-managed deployment, ColdFusion can package the entire application, its settings, and its CFML files into an Enterprise Application Archive (EAR) or Web Application Archive (WAR) instead of a CAR file. Building one involves choosing the archive type, specifying a context root (which controls the application's URL path), and for Enterprise Edition, a serial number.
Precompiling with cfcompile
cfcompile precompiles .cfm/.cfc files into Java classes ahead of time, instead of ColdFusion compiling them on first request.
# standard precompilation cfcompile webroot [directory-to-compile] # sourceless distribution: deploy only compiled classes, no .cfm/.cfc source cfcompile -deploy webroot directory-to-compile output-directory
The -deploy form is specifically for distributing an application without its original CFML source, useful when shipping to an environment you don't want the source code sitting on.
Common Beginner Mistakes
Assuming Administrator or RDS passwords travel with a CAR file
They don't, by design. Those need to be set manually on the target server after deployment.
Trying to deploy a CAR file built on a newer ColdFusion version onto an older one
ColdFusion doesn't unpack archives created in earlier versions, but the reverse (an older archive onto a newer version) isn't guaranteed either. Build and deploy against matching versions.
Not checking datasource paths after deploying a CAR file
MS Access, Derby, and other path-based datasource drivers don't get their directory paths translated automatically. Verify and fix those in the Administrator (or server_setting.xml) after deployment, don't assume they just work.
Best Practices
- Set Administrator/RDS passwords manually on the target server, don't expect a CAR file to carry them.
- Keep CAR archives built and deployed against matching ColdFusion versions.
- Verify path-based datasources after any CAR deployment, specifically MS Access and Derby.
- Use cfcompile -deploy when shipping to an environment where the original CFML source shouldn't be present.
Interview Questions
What does a ColdFusion Archive (CAR) file actually let you package together?
Almost anything about a site: directories, files, CFX tags, ColdFusion mappings, Solr collections, scheduled tasks, and server settings, all bundled under one named archive definition.
What are two things a CAR deployment explicitly does not carry over?
Administrator and RDS passwords, and archives created in an earlier ColdFusion version can't be unpacked at all. Both need to be handled manually.
What does cfcompile -deploy actually produce, and why would you use it?
A sourceless distribution, compiled Java classes without the original .cfm/.cfc source files. It's used when deploying to an environment where you don't want the application's source code present.
Summary
In this lesson, you packaged and deployed a ColdFusion Archive (CAR) file, saw what CAR deployment explicitly doesn't carry over (passwords, cross-version archives, some datasource paths), looked at JEE EAR/WAR as an alternative deployment format, and precompiled an application with cfcompile for a sourceless distribution. That closes out Module 17: Frameworks & Deployment.
What's Next?
Module 18 moves into Practice Projects, starting with a Calculator, applying everything from the course so far to complete, real builds.