PLEASE HELP! Why Is This Application.cfc Throwing Errors?

Posted October 18, 2006 at 8:16 AM by Ben Nadel

Tags: ColdFusion

Can anyone help me out on this error? I thought that I had solved the problem in my other post, but it turns out, that was not causing the ColdFusion event error. The error popped back up again. Here is error:

An exception occurred when invoking a event handler method from Application.cfc The method name is: onApplicationEnd.

What is going on? Here is Application.cfc Code:

  • <cfcomponent
  • displayname="Application"
  • output="true"
  • hint="Handle the application.">
  •  
  •  
  • <cfscript>
  •  
  • THIS.Name = "App Event Testing";
  • THIS.ApplicationTimeout = CreateTimeSpan( 0, 0, 0, 20 );
  • THIS.SessionManagement = true;
  • THIS.SessionTimeout = CreateTimeSpan( 0, 0, 0, 15 );
  • THIS.LoginStorage = "SESSION";
  • THIS.SetClientCookies = true;
  •  
  • </cfscript>
  •  
  •  
  • <cfsetting
  • requesttimeout="10"
  • showdebugoutput="false"
  • enablecfoutputonly="false"
  • />
  •  
  •  
  • <cffunction name="OnApplicationStart" access="public" returntype="boolean" output="true"
  • hint="Fires when the application is first created.">
  •  
  • <!--- Return out. --->
  • <cfreturn true />
  • </cffunction>
  •  
  •  
  • <cffunction name="OnSessionStart" access="public" returntype="void" output="true"
  • hint="Fires when the session is first created.">
  • </cffunction>
  •  
  •  
  • <cffunction name="OnRequestStart" access="public" returntype="boolean" output="true"
  • hint="Fires when prior to page processing.">
  •  
  • <!--- Define arguments. --->
  • <cfargument name="TargetPage" type="string" required="yes" />
  •  
  • <!--- Return out. --->
  • <cfreturn true />
  • </cffunction>
  •  
  •  
  • <cffunction name="OnRequest" access="public" returntype="void" output="true"
  • hint="Fires after pre page processing is complete.">
  •  
  • <!--- Define arguments. --->
  • <cfargument name="TargetPage" type="string" required="yes" />
  •  
  • <!--- Include the requested page. --->
  • <cfinclude template="#ARGUMENTS.TargetPage#" />
  • </cffunction>
  •  
  •  
  • <cffunction name="OnRequestEnd" access="public" returntype="void" output="true"
  • hint="Fires after the page processing is complete.">
  • </cffunction>
  •  
  •  
  • <cffunction name="OnSessionEnd" access="public" returntype="void" output="true"
  • hint="Fires when the session is terminated.">
  •  
  • <!--- Define arguments. --->
  • <cfargument name="SessionScope" type="struct" required="true" />
  • <cfargument name="ApplicationScope" type="struct" required="false" default="#StructNew()#" />
  • </cffunction>
  •  
  •  
  • <cffunction name="OnApplicationEnd" access="public" returntype="void" output="false"
  • hint="Fires when the application is terminated.">
  •  
  • <cfargument name="ApplicationScope" type="struct" required="false" default="#StructNew()#" />
  • </cffunction>
  •  
  •  
  • <cffunction name="OnError" access="public" returntype="void" output="true"
  • hint="Fires when an exception occures that is not caught by a try/catch.">
  •  
  • <!--- Define arguments. --->
  • <cfargument name="Exception" type="any" required="true" />
  • <cfargument name="EventName" type="string" required="false" default="" />
  •  
  • <cfsavecontent variable="strTemp">
  • <cfdump var="#ARGUMENTS.Exception#" />
  • </cfsavecontent>
  •  
  • <cffile
  • action="WRITE"
  • file="#ExpandPath( './error.htm' )#"
  • output="#strTemp#"
  • />
  • </cffunction>
  •  
  • </cfcomponent>

I have ONE other page in the system. The index.cfm page:

  • <cfoutput>
  •  
  • <cfdump var="#APPLICATION#" />
  •  
  • </cfoutput>

I cannot for the life of me figure this out. PLEASE HELP!



Reader Comments

Oct 18, 2006 at 9:11 AM // reply »
5 Comments

Wow, not sure what the problem is. I just copied your code into a temp directory on my server and it ran fine. Have you restarted your CF lately?

FWIW, I'm on Apache 2.0.58 (on XP) w/ Enterprise CF 7,0,2,142559


Oct 18, 2006 at 9:14 AM // reply »
11,241 Comments

6Dust,

Just to be clear, it's not writing any HTML file (error.htm) to the temp directory. You wouldn't be able to see the error on screen when running the index.cfm file.


Oct 18, 2006 at 10:02 AM // reply »
21 Comments

Ben,

Even I pasted your code in my system and run it, it works fine with no error. So where should I see the error?.

The file is not created and no dumping is there, is that your case?


Ed
Oct 18, 2006 at 10:05 AM // reply »
12 Comments

i confirm that. i did try to run it on my end and it worked just fine. and no html file with error was created. the html eror file is created only if i ty with a purpose to create errors in index.cfm.


Oct 18, 2006 at 10:53 AM // reply »
11,241 Comments

I tried stripping out the OnError method and obviously the page works fine (as the OnSEssionEnd and OnApplicationEnd are not browser-related issues). However, I am also seeing that NONE of the errors are getting logged in the ColdFusion Application.log file. How strange is that??


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

Works fine for me too - CF MX 7 on Windows 2003 server...

Everyone here has run it successfully; have you tried deleting your files and recreating them from what you've posted on the blog?


Oct 18, 2006 at 12:26 PM // reply »
11,241 Comments

Seb et al,

I have tried moving files around to no avail... here is an update:

http://bennadel.com/index.cfm?dax=blog:355.view


rob
Dec 12, 2006 at 7:44 PM // reply »
1 Comments

heeyyyyyyyyyyyyyyyyyyyyy!!! sweet,,, this just made my day


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
May 22, 2013 at 11:27 AM
Strange Interaction Between DeserializeJson(), ArrayContains(), And Database Values In ColdFusion
@Tom, Good thought, but no dice. Both of these still exhibit the same behavior: users.id[ users.currentRow ] users[ "id" ][ users.currentRow ] It's just something whacky happening with ... read »
May 22, 2013 at 11:07 AM
Strange Interaction Between DeserializeJson(), ArrayContains(), And Database Values In ColdFusion
Could your problem be that "users.id" is actually an ARRAY, not a single value? Perhaps try it again with "users.id[1]" (I only have CF8 here at work). ... read »
May 22, 2013 at 7:52 AM
Nested Views, Routing, And Deep Linking With AngularJS
Hi, Just a quick thank you. As it happens, for my own purposes, the pending ui-router work being done in native angular is likely the one I'll adopt, but your exploration, code and documentation of ... read »
May 22, 2013 at 4:43 AM
How Do You Use The ColdFusion CFParam Tag?
'<cfparam>' or 'isDefined()and <cfset>' performs the same task.Is there any difference? ... read »
May 21, 2013 at 7:46 PM
Using Plupload For Drag & Drop File Uploads In ColdFusion
No luck. At least I have uncovered the cause, URLScan 3.1. Here is what I see in the IIS log when a file is over 30mb. 2013-05-21 23:29:05 10.105.45.128 GET /plupload/assets/jquery/jquery-1.8. ... read »
May 21, 2013 at 6:12 PM
Using Plupload For Drag & Drop File Uploads In ColdFusion
Ben, I did not see you after Pete Freitag's Lockdown session at cfObjective but he said that IIS sets file size limits at 30MB by default which just happened to be the threshold for file size when ... read »
May 21, 2013 at 11:51 AM
Ask Ben: Parsing Very Large XML Documents In ColdFusion
Looking at my first ever XML document that I have to parse and put into MS SQL 2000 with CF8. I get it to list the desired Field name, many times over, and have a long list of this field name displa ... read »
May 21, 2013 at 9:25 AM
Turning Off and On Identity Column in SQL Server
you are awesome..i am lucky to get this blog between such a garbage one....Thanks, Prashant ... read »
InVision App - Prototyping Made Beautiful With Prototyping Tools