Skip to main content
April 5, 2011
Question

Could not find the ColdFusion component or interface

  • April 5, 2011
  • 3 replies
  • 14496 views

I don't know what else to try.  I have created a fully functional ORM CRUD application that is working perfectly when I have the mapping cfc located in the root folder with the index.cfm file that is using it.  However, as soon as I move the mapping cfc into the "ORM" folder that is in the root folder and add the cfclocation attribute all I ever get is that it can't find the component or interface.  To make sure that it works and I don't have any strange errors I have (in the index.cfm file) instanciated it using createObject with a path of "orm.HistoricalEvents" and then dump it to the screen and that works just fine as well.  Below is my setup and directory structure.  If anyone has any suggestions i would love to hear them.  I love the ORM capabilities and want to use them but I don't want to have a pile of mapping cfcs just sitting in the root folder.

Setup:

Windows 7 Enterprise, 64 bit

IIS 7.5

File Directory/IIS Physical Path: C:\WebDev\DevGamma

Virtual Directory under IIS Default Web Site: /DevGamma

ColdFusion Developer Edition > Standard Installation > All IIS Websites

ColdFusion Directory Location: C:\ColdFusion9

CFIDE Directory Location: C:\inetpub\wwwroot\CFIDE

Folder Structure:

[root]

     /orm

          HistoricalEvents.cfc

     Application.cfc

     index.cfm

Application.cfc

component
{
        this.name = "CF/1 Application Generator16";
        this.version = 1.0;
        this.datasource = "fw1testdsn";
        this.sessionmanagement = true;
        this.ormenabled = true;
           
       
       
        this.ormsettings = {
            autorebuild="true",
            dialect="MicrosoftSQLServer",
            dbcreate="update",
            cfclocation="orm"
        };
       
}

HistoricalEvents.cfc

component persistent="true" table="HistoricalEvents"
{
    property name="EventID" fieldtype="id" ormtype="int" generator="identity";
    property name="EventDate" ormtype="date";
    property name="EventTitle" ormtype="string" length=250;
    property name="EventLocation" ormtype="string" length=50;
    property name="EventType" ormtype="string" length=30;
    property name="EventRating" ormtype="short";
    property name="IsPositiveEvent" ormtype="boolean";
}

index.cfm

<cfset data = EntityToQuery(entityLoad("HistoricalEvents"))>
<cfdump var="#data#">

If anyone needs more information please let me know.  If you have any suggestions please send them my way.  I want to use ORM but this is killing me and is a deal breaker if I can't get the cfclocation thing to "see" my components.  Thanks!

Jason

This topic has been closed for replies.

3 replies

Inspiring
August 31, 2022

Try adding this in your app cfc.  Then use them when Creating your CFCs.

You should then be able to use approot.orm.mycfc

<cfset this.mappings["/approot"] = getDirectoryFromPath(getCurrentTemplatePath()) />
BKBK
Community Expert
Community Expert
September 3, 2022

 > cfclocation="orm"

 

Instead of just orm, I would suggest using the absolute path of the orm directory.

Participant
August 18, 2022

I know that this question is ages old, but did you ever find a solution for this? I tried jingelsthula's recommendation of adding the path to the application.cfc's this.customTagsPath property, but it didn't help. We are using a slightly different environment (Windows 10, CF10), but the description of your issue matches mine exactly.

I'm also eager to use the features of ORM, but have already wasted the majority of a work day trying to figure this issue out.

Thank you.

Participant
August 19, 2022

Upon further review - jingelsthula's recommendation did end up being the solution for us. I had not set the customTagsPath value correctly.

 

I'm providing the following as an example of what we did, just in case it helps someone else.

 

Folder Structure

[root]

..application.cfc

..index.cfm

..[Models]

....Employees.cfc

 

Application.cfc (the relevant portion)

component {

    ...

    this.ormenabled = true;

    this.datasource = "my_data_source";

    

    //Using customTagPaths INSTEAD of this.ormsettings.cfclocation

    this.customTagPaths = "#GetDirectoryFromPath(GetCurrentTemplatePath())#Models";

}

 

Employees.cfc

component persistent="true" table="tblEmployees" {

}

 

index.cfm

<cscript>

    allEmployees = EntityLoad("Employees");

    writeDump(allEmployees);  //Now works

</cfscript>

Inspiring
April 5, 2011

When u invoke cfc just by its name CF automatically scans ur site root, web root and any custom path specified in the CF administrator.  So first 2 don't apply since you moved it to a folder, so do yuo have "orm" folder set as custom tag path?

have u tried using qualified path to call your cfc, like "orm.HistoricalEvents" given that the filename for ur cfc is HistoricalEvents.cfc?

April 5, 2011

Both ...

<cfset data = EntityToQuery(entityLoad("orm.HistoricalEvents"))>

and

<cfset data = EntityToQuery(entityLoad("devgamma.orm.HistoricalEvents"))

results in "Mapping for component [whatever path I try] not found"

I also don't have any orm path's mapped anywhere (neither CFX Tags nor ColdFusion Mappings).

Inspiring
April 6, 2011

I haven't had much expirience with ORM but maybe try following:

<cfset data= CreateObject("component", "orm.HistoricalEvents")>
<cfset data= EntityToQuery(EntityLoad(data))>

or even map custom tag path to your ORM folder