HibernateException and ColdBox Controller Not Found

Ok, I'm having some strange issues with the ORM and ColdBox. With ORM
event handling disabled, if I do an EntityNew and then EntitySave,
things work fine. But, when I enable event handling with the ColdBox
ORMEventHandler, things go crazy. If you take a look at the following
error message, you'll see both something about
org.hibernate.HibernateException and Coldbox Controller Not Found. I
have no idea if the ORM, ColdBox, or my code is the culprit here.

Any ideas?

Message:
ERROR 10:45:24.139 AM Backhauls
Application Execution Exception CFErrorType=Application CFDetails=Root
cause :org.hibernate.HibernateException:
coldfusion.runtime.CustomException: ColdBox Controller Not Found
CFMessage=coldfusion.runtime.CustomException: ColdBox Controller Not
Found CFStackTrace=org.hibernate.HibernateException:
coldfusion.runtime.CustomException: ColdBox Controller Not Found at
coldfusion.orm.hibernate.HibernateEventHandler.invokeMethod(HibernateEventHandler.java:
272) at
coldfusion.orm.hibernate.HibernateEventHandler.invokeInterceptorMethod(HibernateEventHandler.java:
190) at
coldfusion.orm.hibernate.HibernateEventHandler.onSave(HibernateEventHandler.java:
116) at
org.hibernate.event.def.AbstractSaveEventListener.substituteValuesIfNecessary(AbstractSaveEventListener.java:
414) at
org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:
293) at
org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:
204) at
org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:
144) at
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:
210) at
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:
195) at
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:
117) at
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:
93) at
org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:677)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:669)
at
coldfusion.orm.hibernate.SessionWrapper.saveOrUpdate(SessionWrapper.java:
428) at
coldfusion.orm.hibernate.HibernatePersistenceManager.save(HibernatePersistenceManager.java:
145) at
coldfusion.orm.hibernate.HibernatePersistenceManager.save(HibernatePersistenceManager.java:
127) at coldfusion.orm.ORMUtils.entitySave(ORMUtils.java:195) at
coldfusion.runtime.CFPage.EntitySave(CFPage.java:7745) at
cfGeneral2ecfc618134617$funcINDEX.runFunction(C:\WebRoot\Development\CF
\Projects\BH\handlers\General.cfc:36) at
coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472) at
coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47) at
coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:
405) at coldfusion.runtime.UDFMethod
$ArgumentCollectionFilter.invoke(UDFMethod.java:368) at
coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:
55) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:517) at
coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:496) at
coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:355) at
coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2301) at
coldfusion.tagext.lang.InvokeTag.doEndTag(InvokeTag.java:389) at
coldfusion.runtime.CfJspPage._emptyTcfTag(CfJspPage.java:2723) at
cfController2ecfc157287809$funcINVOKER.runFunction(C:\WebRoot
\Development\Coldbox\3.0.0.RC2\system\web\Controller.cfc:704) at
coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472) at
coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47) at
coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:
405) at coldfusion.runtime.UDFMethod
$ArgumentCollectionFilter.invoke(UDFMethod.java:368) at
coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:
55) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220) at
coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:2582) at
cfController2ecfc157287809$funcRUNEVENT.runFunction(C:\WebRoot
\Development\Coldbox\3.0.0.RC2\system\web\Controller.cfc:591) at
coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472) at
coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47) at
coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:
405) at coldfusion.runtime.UDFMethod
$ArgumentCollectionFilter.invoke(UDFMethod.java:368) at
coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:
55) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:517) at
coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:496) at
coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:355) at
coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2301) at
cfColdbox2ecfc2094948977$funcPROCESSCOLDBOXREQUEST.runFunction(C:
\WebRoot\Development\Coldbox\3.0.0.RC2\system\Coldbox.cfc:243) at
coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472) at
coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:
405) at coldfusion.runtime.UDFMethod
$ArgumentCollectionFilter.invoke(UDFMethod.java:368) at
coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:
55) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220) at
coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:491) at
coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:337) at
coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2360) at
cfApplication2ecfc422500432$funcONREQUESTSTART.runFunction(C:\WebRoot
\Development\CF\Projects\BH\Application.cfc:87) at
coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472) at
coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:
405) at coldfusion.runtime.UDFMethod
$ArgumentCollectionFilter.invoke(UDFMethod.java:368) at
coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:
55) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220) at
coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:491) at
coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:337) at
coldfusion.runtime.AppEventInvoker.invoke(AppEventInvoker.java:88) at
coldfusion.runtime.AppEventInvoker.onRequestStart(AppEventInvoker.java:
258) at
coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:349)
at
coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:
48) at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:
40) at coldfusion.filter.PathFilter.invoke(PathFilter.java:94) at
coldfusion.filter.LicenseFilter.invoke(LicenseFilter.java:27) at
coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70) at
coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:
28) at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46) at
coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38) at
coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22) at
coldfusion.filter.CachingFilter.invoke(CachingFilter.java:62) at
coldfusion.CfmServlet.service(CfmServlet.java:200) at
coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:
89) at jrun.servlet.FilterChain.doFilter(FilterChain.java:86) at
coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:
42) at
coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:94) at
jrun.servlet.FilterChain.service(FilterChain.java:101) at
jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106) at
jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42) at
jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:
286) at
jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:
543) at jrun.servlet.http.WebService.invokeRunnable(WebService.java:
172) at jrunx.scheduler.ThreadPool
$ThreadThrottle.invokeRunnable(ThreadPool.java:428) at
jrunx.scheduler.WorkerThread.run(WorkerThread.java:66) Caused by:
coldfusion.runtime.CustomException: ColdBox Controller Not Found at
coldfusion.tagext.lang.ThrowTag.doStartTag(ThrowTag.java:142) at
coldfusion.runtime.CfJspPage._emptyTcfTag(CfJspPage.java:2722) at
cfUtil2ecfc491228005$funcTHROWIT.runFunction(C:\WebRoot\Development
\Coldbox\3.0.0.RC2\system\core\util\Util.cfc:164) at
coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472) at
coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47) at
coldfusion.runtime.UDFMethod
$ArgumentCollectionFilter.invoke(UDFMethod.java:368) at
coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:
55) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220) at
coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:491) at
coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:337) at
coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2360) at
cfColdboxProxy2ecfc582985828$funcVERIFYCOLDBOX.runFunction(C:\WebRoot
\Development\Coldbox\3.0.0.RC2\system\remote\ColdboxProxy.cfc:199) at
coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472) at
coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47) at
coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:
405) at coldfusion.runtime.UDFMethod
$ArgumentCollectionFilter.invoke(UDFMethod.java:368) at
coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:
55) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220) at
coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:2582) at
cfColdboxProxy2ecfc582985828$funcGETCONTROLLER.runFunction(C:\WebRoot
\Development\Coldbox\3.0.0.RC2\system\remote\ColdboxProxy.cfc:209) at
coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472) at
coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47) at
coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:
405) at coldfusion.runtime.UDFMethod
$ArgumentCollectionFilter.invoke(UDFMethod.java:368) at
coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:
55) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220) at
coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:2582) at
cfColdboxProxy2ecfc582985828$funcANNOUNCEINTERCEPTION.runFunction(C:
\WebRoot\Development\Coldbox\3.0.0.RC2\system\remote\ColdboxProxy.cfc:
137) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472) at
coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47) at
coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:
405) at coldfusion.runtime.UDFMethod
$ArgumentCollectionFilter.invoke(UDFMethod.java:368) at
coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:
55) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220) at
coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:2582) at
cfEventHandler2ecfc744265142$funcPREINSERT.runFunction(C:\WebRoot
\Development\Coldbox\3.0.0.RC2\system\orm\hibernate\EventHandler.cfc:
74) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472) at
coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:
405) at coldfusion.runtime.UDFMethod
$ArgumentCollectionFilter.invoke(UDFMethod.java:368) at
coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:
55) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220) at
coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:491) at
coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:337) at
coldfusion.orm.hibernate.HibernateEventHandler.invokeMethod(HibernateEventHandler.java:
269) ... 97 more CFTagContext=ID: CF_CFPAGE; LINE: 36; TEMPLATE: C:
\WebRoot\Development\CF\Projects\BH\handlers\General.cfc ID: CFINVOKE;
LINE: 704; TEMPLATE: C:\WebRoot\Development\Coldbox\3.0.0.RC2\system
\web\Controller.cfc ID: CF_UDFMETHOD; LINE: 591; TEMPLATE: C:\WebRoot
\Development\Coldbox\3.0.0.RC2\system\web\Controller.cfc ID:
CF_TEMPLATEPROXY; LINE: 243; TEMPLATE: C:\WebRoot\Development\Coldbox
\3.0.0.RC2\system\Coldbox.cfc ID: CF_TEMPLATEPROXY; LINE: 87;
TEMPLATE: C:\WebRoot\Development\CF\Projects\BH\Application.cfc ID:
CFTHROW; LINE: 164; TEMPLATE: C:\WebRoot\Development\Coldbox
\3.0.0.RC2\system\core\util\Util.cfc ID: CF_TEMPLATEPROXY; LINE: 199;
TEMPLATE: C:\WebRoot\Development\Coldbox\3.0.0.RC2\system\remote
\ColdboxProxy.cfc ID: CF_UDFMETHOD; LINE: 209; TEMPLATE: C:\WebRoot
\Development\Coldbox\3.0.0.RC2\system\remote\ColdboxProxy.cfc ID:
CF_UDFMETHOD; LINE: 137; TEMPLATE: C:\WebRoot\Development\Coldbox
\3.0.0.RC2\system\remote\ColdboxProxy.cfc ID: CF_UDFMETHOD; LINE: 74;
TEMPLATE: C:\WebRoot\Development\Coldbox\3.0.0.RC2\system\orm\hibernate
\EventHandler.cfc

Ok, after working on this a bit more I've figured out that if I edit
the BaseORMService and change the line that says

property name="eventHandling" type="boolean" default="true";

to have a default of false, it starts working. Still, I have no idea
why this helps. I just noticed that one of the couple error messages I
got mentioned error handling so it led me to this. I've tried my ORM
code under a non-Coldbox app and it works fine, so it would seem to
suggest something on the Coldbox side. Perhaps I've misconfigured
something?

Any thoughts?

I would assume that setting the ‘eventHandling’ property to false “works” simply because you are turning off event handling. :slight_smile:

In other words, it does not get down to the root of the issue. The error message you are seeing is pretty straight forward: the ColdBox controller is not found. Which one? I don’t know. Why is it not found? I don’t know. I don’t use any of the built-in ORM stuff, so I won’t be of much (any?) help there. But I would start by checking to make sure you have appropriately configured all paths and mappings.

Sounds like the problem is in the Event Handler that you are using, did you check in there?

It sounds like you are trying to either inject the controller and it is failing, or you are trying to use the controller without getting it right, or the ORMEvent Handler is extending the wrong component.

Regards,

Andrew Scott

http://www.andyscott.id.au/

Sounds like the problem is in the Event Handler that you are using, did you check in there?

It sounds like you are trying to either inject the controller and it is failing, or you are trying to use the controller without getting it right, or the ORMEvent Handler is extending the wrong component.

Regards,

Andrew Scott

http://www.andyscott.id.au/

Sorry for the delayed response. Been busy last few days.

I have checked and the controller is definitely there in the
Application scope. I'm wondering if the problem is that I altered the
Application.cfc so that when it sets up ColdBox, it uses a custom
COLDBOX_APP_KEY and a custom cbBootstrap key. Is it not ok to change
those values?

Upon looking at the system/remote/ColdBoxProxy.cfc file, I noticed
this on line 18:

setCOLDBOX_APP_KEY("cbController");

Is this hard coding the controller key? I'm running multiple Coldbox
applications under the same Application scope so I changed the
defaults in Application.cfc thinking they wouldn't interfere. Is that
what's causing my problems?

Thanks

I changed the line in ColdBoxProxy.cfc that says

setCOLDBOX_APP_KEY("cbController");

to use by custom app key and everything seems to be working now. Is
this something can be changed so it picks up the custom app key
instead of having to change it manually? Also, are there any other
hardcoded values like this that I need to watch out for? I looked at
the application scope and saw that there is a "wirebox" key containing
a "coldbox.system.ioc.Injector" object. I'm going to assume that if I
run another CB app under this same Application scope then I'll run
into conflicts. Is there a way to change the key? I did a few searches
of the CB source but couldn't find where it is set into the
application scope.

After doing some tinkering, I found that in RC2, a "wirebox" key
containing a "coldbox.system.ioc.Injector" object is created in the
Application scope. In RC1, it isn't there -- it never gets created in
the Application scope. Everything works the same, just the "wirebox"
object isn't there in the scope. Is this by design or a bug in RC2?

I need to have two Coldbox apps running under the same Application
scope so I need to make sure they won't interfere. If both apps create
a "wirebox" object then I assume they'd interfere with each other. I
can rename the controller and bootstrap without problems but I don't
see any way to do the same for wirebox.

Well, the default key is cbcontroller. If you have multiple then you need to tell the proxy or event handler which controller you would like to talk to. So what you did is the way to do it.

Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

You can configure the scope registration via the configuration binder: http://wiki.coldbox.org/wiki/WireBox.cfm#scopeRegistration

Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Great! Thanks for the help!