[COLDBOX-5.0] onError Exception - The variable: ExceptionBean is undefined in the request collection

I’m getting an error that I’m dumping within the onError function, which I don’t quite understand.

code
`


public function onError(eventname,exception){
writeDump(var:exception);
writeDump(var:eventname);

}

`

It looks like an error in the onRequest?

In the dump it’s showing the following information.
I did collapse some of the sections. Hopefully I left the ones that have useful information.
Am I looking in the correct place to figure this out?

Cause
Struct

code
string

Detail
string Keys Found: GETTIMEZONESHORTNAME,GETLOCALDATETIME,event,GETDATEFROMTZ,CASTUTCDATETIME,GETUTCDATETIME,deployBroadcast

ErrorCode
string

Extended_Info
string

ExtendedInfo
string

Message
string The variable: ExceptionBean is undefined in the request collection (private=false)

name
string onRequest

rootCause
Struct

StackTrace
string lucee.runtime.exp.CustomTypeException: The variable: ExceptionBean is undefined in the request collection (private=false) at lucee.runtime.tag.Throw._doStartTag(Throw.java:212) at lucee.runtime.tag.Throw.doStartTag(Throw.java:201) at throw_cfm$cf.udfCall(/throw.cfm:11) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:107) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:357) at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:212) at lucee.runtime.functions.system.CFFunction.call(CFFunction.java:103) at coldbox.system.web.context.requestcontext_cfc$cf.udfCall2(/coldbox/system/web/context/RequestContext.cfc:376) at coldbox.system.web.context.requestcontext_cfc$cf.udfCall(/coldbox/system/web/context/RequestContext.cfc) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:107) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:357) at lucee.runtime.type.UDFImpl.call(UDFImpl.java:226) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:687) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:567) at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1988) at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:756) at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1718) at handlers.main_cfc$cf.udfCall(/ramses/handlers/main.cfc:68) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:107) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:357) at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:212) at lucee.runtime.type.scope.UndefinedImpl.callWithNamedValues(UndefinedImpl.java:780) at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:833) at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1737) at coldbox.system.eventhandler_cfc$cf.udfCall(/coldbox/system/EventHandler.cfc:89) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:107) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:357) at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:212) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:689) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:567) at lucee.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:2005) at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:833) at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1737) at coldbox.system.web.controller_cfc$cf.udfCall3(/coldbox/system/web/Controller.cfc:900) at coldbox.system.web.controller_cfc$cf.udfCall(/coldbox/system/web/Controller.cfc) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:107) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:357) at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:212) at lucee.runtime.type.scope.UndefinedImpl.callWithNamedValues(UndefinedImpl.java:780) at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:833) at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1737) at coldbox.system.web.controller_cfc$cf.udfCall2(/coldbox/system/web/Controller.cfc:733) at coldbox.system.web.controller_cfc$cf.udfCall(/coldbox/system/web/Controller.cfc) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:107) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:357) at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:212) at lucee.runtime.type.scope.UndefinedImpl.callWithNamedValues(UndefinedImpl.java:780) at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:833) at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1737) at coldbox.system.web.controller_cfc$cf.udfCall2(/coldbox/system/web/Controller.cfc:467) at coldbox.system.web.controller_cfc$cf.udfCall(/coldbox/system/web/Controller.cfc) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:107) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:357) at lucee.runtime.type.UDFImpl.call(UDFImpl.java:226) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:687) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:567) at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1988) at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:756) at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1718) at coldbox.system.bootstrap_cfc$cf.udfCall2(/coldbox/system/Bootstrap.cfc:555) at coldbox.system.bootstrap_cfc$cf.udfCall(/coldbox/system/Bootstrap.cfc) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:107) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:357) at lucee.runtime.type.UDFImpl.call(UDFImpl.java:226) at lucee.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:771) at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:756) at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1718) at coldbox.system.bootstrap_cfc$cf.udfCall1(/coldbox/system/Bootstrap.cfc:356) at coldbox.system.bootstrap_cfc$cf.udfCall(/coldbox/system/Bootstrap.cfc) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:107) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:357) at lucee.runtime.type.UDFImpl.call(UDFImpl.java:226) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:687) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:567) at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1988) at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:756) at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1718) at ramses.application_cfc$cf.udfCall(/ramses/Application.cfc:529) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:107) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:357) at lucee.runtime.type.UDFImpl.call(UDFImpl.java:226) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:687) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:567) at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1988) at lucee.runtime.listener.ModernAppListener.call(ModernAppListener.java:424) at lucee.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:223) at lucee.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:43) at lucee.runtime.PageContextImpl.execute(PageContextImpl.java:2464) at lucee.runtime.PageContextImpl._execute(PageContextImpl.java:2454) at lucee.runtime.PageContextImpl.executeCFML(PageContextImpl.java:2427) at lucee.runtime.engine.Request.exe(Request.java:44) at lucee.runtime.engine.CFMLEngineImpl._service(CFMLEngineImpl.java:1091) at lucee.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:1039) at lucee.loader.engine.CFMLEngineWrapper.serviceCFML(CFMLEngineWrapper.java:102) at lucee.loader.servlet.CFMLServlet.service(CFMLServlet.java:51) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129) at org.cfmlprojects.regexpathinfofilter.RegexPathInfoFilter.doFilter(RegexPathInfoFilter.java:47) at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176) at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145) at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92) at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:389) at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84) at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62) at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:64) at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:132) at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46) at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64) at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60) at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77) at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292) at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81) at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138) at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135) at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48) at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43) at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272) at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81) at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104) at io.undertow.server.Connectors.executeRootHandler(Connectors.java:336) at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)

TagContext
Array

type
string RequestContext.ValueNotFound

The error is here:

/ramses/handlers/main.cfc:68

And as it states, there is no variables called “ExceptionBean” in the request collection. I believe we moved that to the prc at some point and possibly renamed it,. Just dump out rc and prc at that point and I’m sure you’ll find it.

Thanks. I was able to work out that the error was there eventually.
For reference - I’ve installed the coldbox-legacy-app-demo via commandbox.

I noticed that my handlers/main.cfc is quite a bit different than the legacy example.
Maybe even wrong for use with the new version of CB. Are these functions supposed to be in a handler?
I thought the application.cfc file was the one that had these function declarations.

Enter code here...<cfcomponent name="main" extends="coldbox.system.eventHandler" output="false">


<!------------------------------------------- CONSTRUCTOR ------------------------------------------>

<!--- This init is mandatory, including the super.init(). --->
   <cffunction name="init" access="public" returntype="main" output="false">
      <cfargument name="controller" type="any">
      <cfset super.init(arguments.controller)>
<!--- Any constructor code here --->
      <cfreturn this>
   </cffunction>

<!------------------------------------------- GLOBAL IMPLICIT EVENTS ONLY ------------------------------------------>
<!--- In order for these events to fire, you must declare them in the coldbox.xml.cfm --->

   <cffunction name="onAppInit" access="public" returntype="void" output="false">
      <cfargument name="Event" type="any">

   </cffunction>

   <cffunction name="onRequestStart" access="public" returntype="void" output="false">
      <cfargument name="Event" type="any">
      <cfset var rc = event.getCollection()>
      <Cfif rc.event neq 'general.index' and not isdefined('session.pid')>
         <cfset session.returnPage = '#cgi.script_name#?#cgi.query_string#'>

         <Cfset setNextEvent('general.index')>
      </cfif>
   </cffunction>

   <cffunction name="onRequestEnd" access="public" returntype="void" output="false">
      <cfargument name="Event" type="any">
<!--- ON Request End Here --->
   </cffunction>

   <cffunction name="onSessionStart" access="public" returntype="void" output="false">
      <cfargument name="Event" type="any">
<!--- ON session start Here --->

   </cffunction>

   <cffunction name="onSessionEnd" access="public" returntype="void" output="false">
      <cfargument name="Event" type="any">
<!--- ON session End Here --->
      <cfset var sessionScope = event.getValue("sessionReference")>
      <cfset var applicationScope = event.getValue("applicationReference")>

   </cffunction>

   <cffunction name="onException" access="public" returntype="void" output="false">
      <cfargument name="Event" type="any">
<!--- ON Exception Handler Here --->
      <cfscript>
//Grab Exception From request collection, placed by ColdBox
         writeDump(var:event,abort:true);
         //var exceptionBean = event.getValue("ExceptionBean");
//Place exception handler below:

      </cfscript>
   </cffunction>

</cfcomponent>

Not sure how to answer that question. ColdBox does not require that you have any particular methods in your main handler. In fact, ColdBox doesn’t even require that you have a main handler at all! Those are just examples. If you look in your /config/ColdBox.cfc file you’ll see a bunch of settings that map the events in your Application.cfc over to actual ColdBox event handlers you want fired to process them. If you remove or change the events in your main handler just make sure you remove or update the config that was pointing to them.

thought the application.cfc file was the one that had these function declarations.

You’re confusing two different but related things just because they have similar names.

Methods like onSessionStart in your Application.cfc are part of the core ColdFusion functionality and are run by the CF engine automatically. In ColdBox land, we provide you a bridge so those base CF events can, in turn, fire a full fledged ColdBox event so you can respond to things like a session starting inside of your ColdBox framework. If you like, you could create handler called “foobar” and give it an action called “ILikeSpam” and then configure coldbox to run “foobar.ILikeSpam” to handle a session starting. ColdBox doesn’t care what the name of the event is, but in our sample apps we tend to name them after the ColdFusion event and put them in a main handler just for consistently and sanity.

Thanks. Just wasn’t sure if what was there was part of the “old method” - since the newer examples have ZERO functions in the handlers/main.cfc file.
Taking 2 steps forward and 6 steps back with the errors and converting this app - since I don’t know what “is allowed” - and what is part of the framework - and what is just bad code that got misplaced.
A fresh start coldbox app is so easy … but converting one is a bit of a nightmare.

I’m looking into the config/coldbox.cfc file which I believe replaces the old XML config file.
As far as the go - I don’t understand why the app I’m working on has the same functions both in the application.cfc and /handlers/main.cfc (onRequestStart, onSessionStart).
I thought the handlers just set the view?

the newer examples have ZERO functions in the handlers/main.cfc file.

Can you clarify? Here’s the main.cfc you get when you run “coldbox create app”.

https://github.com/coldbox-templates/advanced-script/blob/master/handlers/Main.cfc

I count 8 implicit functions stubbed out there.

ColdBox doesn’t care what the name of the event is, but in our sample apps we tend to name them after the ColdFusion event and put them in a main handler just for consistently and sanity.

In the legacy app example - I don’t see any events/functions declared as they are in application.cfc
Now I’m REALLY confused on what SHOULD be where.

I explained this above. I would really recommend taking this to Slack. Having a stream of conscious conversation over E-mail is pretty hard and getting harder the more the conversation spirals out.

I thought the handlers just set the view?

Not necessarily. You can do whatever you want in a handler.

My bad. I was looking at the legacy-app skeleton main.cfc.
Your comment about the config/coldbox.cfc reminded me that I had not customized that file with the settings from our coldbox.xml.cfm

Thank you very much for your patience and help.
I think the fog is starting to lift!

BTW … what is the best way to discuss the CFPDFFORM extension that Ortus has for Lucee?
Email?

In the legacy app example - I don’t see any events/functions declared as they are in application.cfc
Now I’m REALLY confused on what SHOULD be where.

Sorry, at this point I have no idea what your asking or what files you’re referring to. I probably just removed the boilerplate stuff from the legacy app example to simplify. The point of that app wasn’t to showcase the implicit event in ColdBox but to show how to integrate legacy code with ColdBox. I’m unclear on why an example that doesn’t include some optional features is confusing.

Thanks. I’ll move the stream of consciousness questions to slack, and keep the posts here a bit more formal.
Again. I sincerely appreciate the help.