I am running ColdFusion 9,0,1,274733 with hotfix 2 applied on a Windows 2008 Server 64-bit with IIS.
I have written a cfc to handle logging (user auditing) to a database table. Basically I call this cfc at different points during the request cycle. On application start, on request end, on application end and when errors occur. It all works perfectly well until the application expires.
So here are some relevant parts from my Application.cfc.
I am defining a mapping to the cfc’s location outside of any cffunction like so:
this.versionfolder="version1";
this.mappings["/modules"]="C:\Webroot\folder\#this.versionfolder#";
Then in the aforementioned application events I can call my logging cfc like so:
<cfinvoke component="/modules/LogIt" method="Store" />
This works fine until the application expires. When the code fires my cfinvoke for the logging module in the OnApplicationEnd method I get this error:
Message: Could not find the ColdFusion component or interface /modules/LogIt.
Detail: Ensure that the name is correct and that the component or interface exists.
I know that the cfc exists it has been calling it the same exact way throughout the application’s life span. Has anybody else seen this behavior?
To throw a wrench at this, the application that I am having this problem with is located in the web root. I have another application, running on this same server, which is located in a sub-folder of this application (they have different application names). I am using the exact same logic in that Application.cfc referencing the same logging cfc via that application’s mapping and it works fine on application end. I am stumped and have not been able to find anything online about this specific scenario.
To be clear, my application in the web root fails every time on application end. My application in the sub-folder works every time. Not sure if this is relevant but the web root application is started (accessed) before the sub-folder application. Although I have tested only hitting the web root application and it still fails. I have also tried using dot-notation for the component name but it still fails.
I just did some research into this because I spotted another question here asking much the same thing.
My findings were that there’s a but in CF8-10 that result in Application.cfc-set mappings do not work in onApplicationEnd() (nor indeed in onSessionEnd() in CF8). the work around is to set the mappings in CFAdmin. Not much of a workaround, I’m afraid.