Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Coldfusion component not found problem

Posted on 2011-02-20
14
Medium Priority
?
604 Views
Last Modified: 2012-08-14
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="web.store.app.login", 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 GPSV2.web.store.app.login and just store.app.login and I get the same component not found error.
0
Comment
Question by:BPSRobertAdmin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
  • 3
  • +1
14 Comments
 
LVL 16

Assisted Solution

by:Gurpreet Singh Randhawa
Gurpreet Singh Randhawa earned 1000 total points
ID: 34940720
I suggest you one way!

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

just like thi!

<cfset Application.cfcPath = "web.store.app">

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
0
 
LVL 11

Expert Comment

by:Brijesh Chauhan
ID: 34940742
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">
0
 
LVL 11

Expert Comment

by:Brijesh Chauhan
ID: 34940763
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" ....
0
Learn by Doing. Anytime. Anywhere.

Do you like to learn by doing?
Our labs and exercises give you the chance to do just that: Learn by performing actions on real environments.

Hands-on, scenario-based labs give you experience on real environments provided by us so you don't have to worry about breaking anything.

 
LVL 16

Expert Comment

by:Gurpreet Singh Randhawa
ID: 34941116
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
0
 
LVL 39

Accepted Solution

by:
gdemaria earned 1000 total points
ID: 34943964

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="store.app.login" ....



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 "web.store.app.login"
0
 

Author Comment

by:BPSRobertAdmin
ID: 34944501
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="store.app.login" (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.
0
 

Author Closing Comment

by:BPSRobertAdmin
ID: 34944525
Thankyou. I put some comments in the last post
0
 
LVL 11

Expert Comment

by:Brijesh Chauhan
ID: 34944989
>> 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...
0
 
LVL 39

Expert Comment

by:gdemaria
ID: 34945033

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
0
 
LVL 11

Expert Comment

by:Brijesh Chauhan
ID: 34945127
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 store.app. .... you can just remember the mapping and use it..

I have been using the same way, just a personal preference..
0
 
LVL 11

Expert Comment

by:Brijesh Chauhan
ID: 34945168
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...

0
 
LVL 39

Expert Comment

by:gdemaria
ID: 34945296

I tested it, it seems that the slash / will work in the first position even though it's supposed to be dot notation
0
 
LVL 11

Expert Comment

by:Brijesh Chauhan
ID: 34945383
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.
0
 

Author Comment

by:BPSRobertAdmin
ID: 34945607
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.

Thanks,
Robert
0

Featured Post

Create CentOS 7 Newton Packstack Running Keystone

A bug was filed against RDO for the installation of Keystone v3. This guide is designed to walk you through the configuration for using Keystone v3 with Packstack. You will accomplish this using various repos and the Answers file.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The technique is by far very Simple! How we can export the ColdFusion query results to DOC file?  Well before writing this I researched a lot in Internet but did not found a good Answer anyways!  So i thought now i should share my small snippet w…
Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question