ColdFusion Mappings and Components
When I first started working with ColdFusion mappings I was confused about how ColdFusion components were found. In addition, I did not understand the relationship between component creation and mappings and custom tag paths.
After some research I found the following surprising results.
When you create a new Component using createObject() ColdFusion searches for the component as follows:
1) First, it attempts to find the component in a subdirectory relative to the calling code. For example, if you attempt to create a component com.MyComponent, it will look for a com subdirectory relative to the .cfc or .cfm file that is currently executing and then search for the MyComponent.cfc within that directory.
2) Next, it looks for the component via a mapping.
3) Next, it looks for the component from the root directory of your site.
4) Lastly, if the component is still not found then ColdFusion searches for the component in the Custom Tag Paths
OK, so what are the implications of this?
Well number (1) is just weird, but it is unlikely that this will actually cause a specific problem within your code.
Number (2) can cause a serious problem within a shared server environment. For example, suppose you have just written a great new application and packaged it up under a directory structure com.yourbusiness.yourcoolapp. You upload this to the root directory of your client's site on a shared server, and all works just fine. A few months later, another developer uploads their own application com.theirbusiness.theircoolapp – but they create a mapping /com pointing to their top level com directory. Suddenly your application stops working. The solution? You need to rename your top level com directory to something else.
This can also be a problem with popular ColdFusion frameworks – suppose you have created an application using ModelGlue, ColdSpring and Reactor which you upload to a shared server environment. If another developer also uploads any of these to another site on the same server then create any of the mappings /modelglue, /coldspring or /reactor, then your application will be running their copy of the framework code, not yours.
So what's the solution? Well, the best solution (if possible) is for you need to have your own server to have control over the mappings created. The other solution is for shared server hosts to prevent the creation of common top level mappings, such as /com, /org as well as the common ColdFusion framework mappings, but I suspect this is unlikely to happen.
As best I can tell, if number (3) was always the first place to look for components then there would be no problems.
Just a note that I tested these on ColdFusion versions 7.0 and 7.02

http://livedocs.macromedia.com/coldfusion/6.1/html...