• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Could not find the ColdFusion component or interface

Guest
Apr 05, 2011 Apr 05, 2011

Copy link to clipboard

Copied

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

TOPICS
Advanced techniques

Views

13.5K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Apr 05, 2011 Apr 05, 2011

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 05, 2011 Apr 05, 2011

Copy link to clipboard

Copied

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).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Apr 05, 2011 Apr 05, 2011

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 06, 2011 Apr 06, 2011

Copy link to clipboard

Copied

Thanks for the suggestion but that did not work either.  I get:

Complex object types cannot be converted to simple values.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Apr 06, 2011 Apr 06, 2011

Copy link to clipboard

Copied

Well good news about that it's finding the cfc service.

Try this:

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

<cfset data=EntityLoadByExample(data)>

<cfset data= EntityToQuery(data)>

or

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

<cfset data= EntityToQuery(data)>


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 07, 2011 Apr 07, 2011

Copy link to clipboard

Copied

First suggestion returned error.  Second returned empty result set.

I'm not looking for a work around as much as a solution to why ColdFusion can't see my component even when I set up the cfclocation value.  I don't like hacks.  They tend to cause issues later on especially if the architecture of ColdFusion changes.

Thanks for the suggestions.

Jason

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 04, 2013 Jun 04, 2013

Copy link to clipboard

Copied

I wholeheartedly agree it seems hacky.  I had a very similar issue and added the path to the model (mapping cfc) on to my application.cfc's this.customTagPaths list and it suddenly started working.

It seems to me.... that if you specify a cfclocation.... it should..... Just Work.  One man's opinion.

See this post where I detail my problem for why I think it can locate the file itself even, but just doesn't know how to handle it: https://groups.google.com/forum/?fromgroups#!topic/coldbox/dFMG5PB6wn4

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 18, 2022 Aug 18, 2022

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 19, 2022 Aug 19, 2022

Copy link to clipboard

Copied

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>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Aug 31, 2022 Aug 31, 2022

Copy link to clipboard

Copied

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()) />

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 03, 2022 Sep 03, 2022

Copy link to clipboard

Copied

LATEST

 > cfclocation="orm"

 

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation