Some developers look at the Exceptions section of the ColdFusion? debugging and get a little nervous... "What do all these errors mean? Is my application broken?"
Normally, when I see errors, they bother me too. However, in the case of the errors you see in the ColdFusion? debugging coming from Model Glue and from ColdSpring?, the errors are not indicative of any problem, rather a decision to an alternative code path.
If you do not have an ORM configured, you'll see an error show up in the exceptions section. This doesn't mean your application is broken, unless you expected to use an ORM. The exception is thrown and caught so the framework can continue processing. Want an example?
Here is the code that generates the error you see about ORM:
<cftry>
<cfset svc = mg.getBean("ormService") />
<cfset adapter = mg.getBean("ormAdapter") />
<cfset mg.setOrmService(svc) />
<cfset mg.setOrmAdapter(adapter) />
<cfcatch type="coldspring.NoSuchBeanDefinitionException">
<!--- No bean, no ORM. --->
</cfcatch>
</cftry>
<cfif not isObject(getOrmAdapter())>
<cfset arguments.event.addTraceStatement("ORM", "No ORM adapter is
configured. You will not be able to scaffold or use generic database
messages.") />
</cfif>
Now we could have written this code to be more aware of what was in ColdSpring?, so we'd know whether or not there was in fact a configured ORM adapter. But that would have required making Model Glue a lot more aware of ColdSpring? than we wanted. We would also have had to add a lot more checks and processing inside Model Glue for this purpose and it just didn't make any sense to do it that way.
So, the logical way to handle it was to directly ask ColdSpring? for the bean:
<cfset svc = mg.getBean("ormService") />
<cfset adapter = mg.getBean("ormAdapter") />
And let ColdSpring? try to work out whether it had such a configuration and whether the bean could be created completely. ColdSpring? throws an error if it doesn't work out, which we catch here:
<cfcatch type="coldspring.NoSuchBeanDefinitionException"> <!--- No bean, no ORM. ---> </cfcatch>
So you see, these errors are really two different applications communicating to make decisions.
![(please configure the [header_logo] section in trac.ini)](/ModelGlue.com/trac.cgi/chrome/site/your_project_logo.png)