Coldfusion component not found problem

I am using version 9, IIS, and testing on my local machine. My virtual dir points at (local path) c:\inetpb\wwwroot\gpsv2\web.

my cfm file is a the top level.
My cfc that I want to use is down two levels "store\app\login.cfc".

When I try an <cfinvoke component="", I get a cannot find component. I have moved the cfc to the same directory and component="login" works fine. So, with am I doing wrong?

I have also tried and just and I get the same component not found error.
Who is Participating?
gdemariaConnect With a Mentor Commented:

cfc path's are always from the webroot down

   so if your cfc is located here...   "store\app\login.cfc"

and "store" is a folder in the ROOT of your website

then you should be able to access it using this

<cfinvoke component="" ....

But it sounds like you are using a virtual directory, which coldfusion doesn't see.    So you want to setup a codlfusion mapping for "web" to   "c:\inetpb\wwwroot\gpsv2\web".    This can be done in the /CFIDE/administrator

Then you can use the code as you ""
Gurpreet Singh RandhawaConnect With a Mentor Web DeveloperCommented:
I suggest you one way!

Application.cfc, Store your complete website path in Application CFC

just like thi!

<cfset Application.cfcPath = "">

and then using this:

<cfinvoke component="#Application.cfcPath#.login" method="mymethod" returnvariable="str"/>

This is the way i use my CFC's no matter how often they are nested, it works flawlessly, but make sure that your folder path is correct
Brijesh ChauhanStaff IT EngineerCommented:
You need a web-root relative pathing, or a mapping-relative path.

Example of paths

YOUR CFC -> C:\ColdFusion9\wwwroot\web\projects\cfc\test.cfc

TEST page here -> C:\ColdFusion9\wwwroot\web\projects\ee\test.cfm

Invoke your component like below

<cfinvoke component="web.projects.cfc.test" method="forTesting"  returnVariable="res">
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Brijesh ChauhanStaff IT EngineerCommented:
You can also create mapping in CF ADMINISTRATOR for you components,

Server Settings > Mappings

Logical Path  --> any name you want to give to remember components, say "components".

Directory Path -->c:\inetpb\wwwroot\gpsv2\web\store\app\

Then you can invoke your component as

<cfinvoke component="/components.login" ....
Gurpreet Singh RandhawaWeb DeveloperCommented:
use the CGI Scope from the debugging from where your path is actually coming from and then you can use the Path and add in the Application.CfcPath and then you can run your CFC, this way you can make it working

if you have have access to the CF Admin, then you can use the following <cfdump var to find the CGI Scope and check what is actual Path in there

and if you have acces to CFADMin the you can use the Mapping Functionality as said above by brijesh
BPSRobertAdminAuthor Commented:
My problem was that I had a <cfobject> tag that needed to be changed also. I did not look at the error message closely enough.

component="" (which as qdemaria states is just below the web root) works fine.

brijeshchauhan - your suggestion might mislead as you are suggesting a physical path.

myselfandhawa - thank you for the code organization tip.
BPSRobertAdminAuthor Commented:
Thankyou. I put some comments in the last post
Brijesh ChauhanStaff IT EngineerCommented:
>> brijeshchauhan - your suggestion might mislead as you are suggesting a physical path.

No I am NOT,  /components, is the LOGICAL path to ALL you components if you want to keep them at one place..

Then you can invoke all your components using this logical path which points to CFC's

<cfinvoke component="/components.login" ....

<cfinvoke component="/components.componentNames" ....

anyways.. your issue is resolved which is what was required...

brij, I don't believe you can use the "/"   in component="/componets  

it would be just  component="components....

The path always starts at the root, so there is no need either way
Brijesh ChauhanStaff IT EngineerCommented:
Yes, you can use.. try it out.. !!

I always keep my components at a place, then create a mapping to them in CF admin and invoke them, it is much shotter then calling .... you can just remember the mapping and use it..

I have been using the same way, just a personal preference..
Brijesh ChauhanStaff IT EngineerCommented:
The DOC says..

You need a web-root relative pathing, or a mapping-relative path.

There is nothing wrong in what I have suggested, but as I said, the user issue is resolved which is what is required...


I tested it, it seems that the slash / will work in the first position even though it's supposed to be dot notation
Brijesh ChauhanStaff IT EngineerCommented:
yes, it works because /components is the LOGICAL PATH in your CF ADMIN.. so you can always refer it with a slash...

I have my components in a dir path like /opt/commercecreators/applicaiton/ccv5/scripts/cfc/ ... so instead of calling it like opt.commercecreators.application.ccv5.... I create a mapping to this director in CF ADMIN and call it the way I suggested above.
BPSRobertAdminAuthor Commented:
Sorry bri. I just assumed that the slash would not work in the dot notation. My bad... I should have tried it before I said anything.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.