Copy link to clipboard
Copied
I have an Application.cfc
In the top I set the mappings as follows:
this.mappings['/deptCFC']=ExpandPath('../cfc/');
test cfm page
<cfinclude template="/deptCFC/yourtest.cfm"><br>
fails to include template which exist in the cfc directory as specified in the this.mappings
if I set this in cfadmin then it works
per-application settings is enabled in cfadmin
i-7 32gb ram 2tb drive
win 7 64bit
eclipse juno 64 bit sr2
cfb3 64 bit installed as plugin
fb4.7 64 bit installed as plugin
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
I returns a value of YES
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Bk,
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" >
<cfscript>
this.name = "MyFireTouch_Mapping";
this.mappings['/deptCFC']=ExpandPath('../cfc/');
this.applicationTimeout = createTimeSpan(0,0,0,0);
this.sessionManagement = "false";
</cfscript>
<cfdump var="#this#">
<cffunction name="onApplicationStart" returntype="boolean" output="true">
<cfset application.dsn = "myfiretouchdb">
<cfset application.debugMode = 0>
<cfreturn true>
</cffunction>
<cffunction name="onRequestStart" returntype="boolean" output="false">
<cfargument name="thePage"type="string"required="true">
<cfif isDefined('url.reinit')>
<cfset onApplicationStart()>
</cfif>
<cfreturn true>
</cffunction>
</component>
The applicaiton will reinitialize upon starting everytime so no need to change the name, but i have tried that part too.
This is all the code there is, and it returns an error stating if cannot locate /deptCFC/yourtest.cfm but the dump of the mappings shows a full path to the correct directory:
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
BK,
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.
Thanks
Jim
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
BK,
I have marked the timeoutspan as the correct answer for my problem thanks for the solution.
Jim