The following is NOT the error. I am still debugging this and I am about to kill myself with frustration!
This was driiiiiving me crazy! I was testing events in the ColdFusion Application.cfc method when my OnError method kept firing during the OnApplicationEnd event. The error that I was getting was not helpful at in the least:
An exception occurred when invoking a event handler method from Application.cfc The method name is: onApplicationEnd.
I started to use the OnError method to CFDump the error to an html file. This is what I got:
The detailed message was:
The method 'onApplicationEnd' could not be found in component.
But, my Application.cfc did IN FACT have an OnApplicationEnd method. Clearly something else was going on. But, how useless is that error? No tag context? It won't even tell me what line the error occurred on? To debug this I started commenting EVERYTHING out until the error went away. Then I started putting code back in. I finally narrowed it down to a method called "Trace". Trace was being invoked by other Application.cfc methods and was writing its arguments to a text file. I started to comment out everything in it until it was just this:
<cffunction name="Trace"> <cfreturn /> </cffunction>
That was throwing an error! WTF right? The only thing I could possibly think of was that "Trace" was some sort of reserved word. So, I renamed it to "EventTrace":
<cffunction name="EventTrace"> <cfreturn /> </cffunction>
And just like that, no more problems. I tried looking in the ColdFusion documentation and saw nothing about this method name being special or reserved in any way. And what's more, you can create a method named "Trace" outside of Application.cfc with out any issue. It seems to be reserved ONLY inside of the Application.cfc component. Crazy huh?
Want to use code from this post? Check out the license.