It should work. Do you get an error message?
To debug, run <cfoutput>#fileExists(expandPath('../cfc/yourtest.cfm'))#</cfoutput> in test.cfm, to verify whether the full path actually exists.
I returns a value of YES
Your debug code returns a value of YES.
The error message is that the mapping does not work, i.e. unable to locate component or interface deptCFC/yourtest.cfm…
Yet the cfdump shows the mapping struct and the path is correct.
Are you sure the file test.cfm is not including a second Application file? Test by temporarily copying Application.cfc to the same directory (assuming they are in different directories).
As a follow-up test, temporarily change the application's name (by changing the value of this.name in Application.cfc). This will force the application to restart.
There are only three files in this test project and they are pictured here:
yourtest.cfm simply returns the current date time:
<cfoutput>Current Date Time Stamp: #now()#</cfoutput>
index.cfm contains a simple cfinclude:
<cfinclude template="/deptCFC/yourtest.cfm" >
Application.cfc is pretty simple straight forward with little code:
<cfcomponent displayname="ApplicationCFC" output="true" >
this.name = "MyFireTouch_Mapping";
this.applicationTimeout = createTimeSpan(0,0,0,0);
this.sessionManagement = "false";
<cffunction name="onApplicationStart" returntype="boolean" output="true">
<cfset application.dsn = "myfiretouchdb">
<cfset application.debugMode = 0>
<cffunction name="onRequestStart" returntype="boolean" output="false">
The applicaiton will reinitialize upon starting everytime so no need to change the name, but i have tried that part too.
It just might be that the application falters or fails. Seeing the 0 timeout confirmed my instincts.
So, let's rule one thing out, and at least avoid complications: give the application a non-zero timeout. For example, this.applicationTimeout = createTimeSpan(1,0,0,0);
P.S.: As a rule, the Application file should not be used for display. Hence, delete the cfdump.
Giving the application a “non-zero” time out solved the issue.
Thank You, I have been beating my head against the wall for a week now!
Now to see if I can get the rest of the problems to go away, i.e. DSN not defined in APPLICATION etc.
This error and others were all secondary to not being able to map to the cfc folder outside of the app root.
Glad to hear. Please kindly mark this as solved. It's the kind of issue to which someone else will be searching for an aswer in future.
I have marked the timeoutspan as the correct answer for my problem thanks for the solution.