ColdFusion Error Thrown When Application.cfc Has Method Named "Trace"

Posted October 17, 2006 at 8:25 PM by Ben Nadel

Tags: ColdFusion

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:


 
 
 

 
CFDump : Application.cfc Error With Trace Method  
 
 
 

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?



Reader Comments

Oct 17, 2006 at 9:47 PM // reply »
1 Comments

Thats is a very odd error indeed.

Just throwing this in, but I also use a method called "trace" in my application. But actually the trace method definition isn't in the Application.cfc file, I cfinclude it in (mixin style). So that seems to have spared me the same problem, and might also offer you a way around that funky error.


Oct 18, 2006 at 8:32 AM // reply »
11,314 Comments

Jordan,

I was incorrect about what was causing the error. Although maybe the Trace method only complicated things. I have taken it out and I am still getting errors (slightly different). It's driving me CRAZY!!!! ARG!


Oct 18, 2006 at 9:59 AM // reply »
171 Comments

@Ben:

Have you tried stripping out all the logic in the onApplicationEnd?

Also, try dumping the class cache and re-starting your server. Perhaps there's a weird class caching issue occuring w/the Application.cfc.


Jan 15, 2010 at 8:26 AM // reply »
1 Comments

Having same problem in developed CFC as well, although my code clearly defines the method.

Throws this error in CF8:
Error Message: The trace method was not found.
Error Detail: Either there are no methods with the specified method name and argument types, or the trace method is overloaded with argument types that ColdFusion cannot decipher reliably. ColdFusion found 0 methods that matched the provided arguments. If this is a Java object and you verified that the method exists, you may need to use the javacast function to reduce ambiguity.


Jan 16, 2010 at 4:09 PM // reply »
11,314 Comments

@Keef,

Did you have a Trace method?


Jan 28, 2011 at 10:49 AM // reply »
26 Comments

I'm going through the logs of an old application here and finding a similar error. I'm thinking it's because something named a method "get". Yep, just get. And I suspect that's causing problems when once the ColdFusion code is being ran in Java (for a lack of a better description of what happens as CF is written in Java)

"The get method was not found."

"Either there are no methods with the specified method name and argument types, or the get method is overloaded with argument types that ColdFusion cannot decipher reliably. ColdFusion found 0 methods that matched the provided arguments. If this is a Java object and you verified that the method exists, you may need to use the javacast function to reduce ambiguity."

In this case, it may be that the instance of the object doesn't have that method at the time it's being called. I don't know. But as much as I like the flexibility of things being loosely typed I wish CF had more reserved method names and keywords just to make sure things don't get mucked up.


Post A Comment

Comment Etiquette: Please do not post spam. Please keep the comments on-topic. Please do not post unrelated questions or large chunks of code. And, above all, please be nice to each other - we're trying to have a good conversation here.

Please review the following issues:

Author Name:


Author Email:

Author Website:

Comment:

Supported HTML tags for formatting: <strong>bold</strong>   <em>italic</em>   <code>code</code>







  • Help Wanted - Find Your Next ColdFusion Job
Ben Nadel's Company - Epicenter Consulting Recent Blog Comments
Jun 20, 2013 at 1:09 AM
The Beauty Of The jQuery Each() Method
my html code : <html> <head> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="nss.js"> ... read »
Jun 19, 2013 at 11:31 PM
Directive Link, $observe, And $watch Functions Execute Inside An AngularJS Context
@Ben, bunch to learn indeed, but thats fun part : ) ... read »
Jun 19, 2013 at 10:41 PM
Referencing ColdFusion Query Columns In A Loop Using Both Array And Dot Notation
Burdock-roots Are you going fat day by day? You need to be good for your family and make some money too. So we bring for you a best product that helps you to be more energetic every day. You will b ... read »
Jun 19, 2013 at 9:52 PM
Working With Inherited Collections In AngularJS
I recognize the applicability of your solution, and how easy it makes to share data across multiple views or even "submodules" of rather simple application. But it seems to me that it creat ... read »
Jun 19, 2013 at 9:38 PM
Directive Link, $observe, And $watch Functions Execute Inside An AngularJS Context
@Alesei, Glad you like it. Even after working with AngularJS for months, I still get a bunch of unexpected, "$digest is already in progress". So hard to debug sometimes! ... read »
Jun 19, 2013 at 9:36 PM
Working With Inherited Collections In AngularJS
@Mike, The relationship of $scope values is definitely an interesting thing! But it's not simple - it really forces you to understand prototypal inheritance, which is not at all a simple topic! Gla ... read »
Jun 19, 2013 at 9:35 PM
Experimenting With The Amazon Simple Storage Service (S3) API Using ColdFusion
@Joe, Oh, super interesting! I had only thought to url-encode the signature; but I think that's because the S3 docs actually have a special NOTE telling you to do so. It would have never occurred t ... read »
Jun 19, 2013 at 9:32 PM
Experimenting With The Amazon Simple Storage Service (S3) API Using ColdFusion
@Richard, Glad you like! Hopefully I'll have some more interesting stuff coming. This morning, I blogged a bit more about generating the pre-signed, query string authenticated URLs; but, then deeme ... read »
InVision App - Prototyping Made Beautiful With Prototyping Tools