Skip to main content
Inspiring
March 11, 2019
Question

Coldfusion per application mapping randomly fails

  • March 11, 2019
  • 2 replies
  • 389 views

In my application.cfc file I have the following code:

this.mappings["/includes"] = "#expandPath('../../priv/inc/')#";

and then on a page I have the following CF include set up:

<cfinclude template="/includes/imageOptimise-thumbnail.cfm">

For the majority of the time when the page is submitted the imageOptimise-thumbnail page runs without any issue but occasionally it will error saying that it can't find the imageOptimise-thumbnail.cfm. If I resubmit the page, chances are it will work but the question is, why is it sometimes not being able to find the page?

I had a look in the CF Admin and I can't see anything in the logs saying that there was an error but it is clearly showing a Coldfusion 'template not found' error message when it fails.

Anyone got any ideas?

This topic has been closed for replies.

2 replies

BKBK
Community Expert
Community Expert
March 11, 2019

Does adding the runonce attribute help? Assuming you're on ColdFusion 10 or above, the syntax is

<cfinclude template="/includes/imageOptimise-thumbnail.cfm" runonce="true">

Oh, and just an aside, I would avoid using a dash in a CFML file name.

WolfShade
Legend
March 11, 2019

We've been suffering from this for ages, and I have not found a solution for it.  Our org inbox is inundated with emails triggered when the header.cfm page cannot be found.

V/r,

^ _ ^