I was following the Model Integration Guide on the wiki under the ORM section. I setup my ColdBox app to basically mirror the examples on the page. However, when I go to hit the index for the handler I created to try this I get “datasource [null] doesn’t exist” as an error. The only place that I have to define the datasource is in my Application.cfc, correct? I’ve checked and double-checked everything to make sure that I haven’t missed anything. My Application.cfc contains the same code as the wiki example (except the datasource name) in the OnRequestStart method. I know it’s a valid datasource as the rest of my app uses it without problem. I’m running out of places to look. Any help would be appreciated.
datasource [null] doesn't exist
at railo.runtime.config.ConfigImpl.getDataSource(ConfigImpl.java:2597):2597
at railo.runtime.orm.hibernate.HibernateORMEngine.createSession(HibernateORMEngine.java:129):129
at railo.runtime.PageContextImpl.getORMSession(PageContextImpl.java:3191):3191
at railo.runtime.orm.ORMUtil.getSession(ORMUtil.java:30):30
at railo.runtime.orm.ORMUtil.getSession(ORMUtil.java:26):26
at railo.runtime.functions.orm.EntityNew.call(EntityNew.java:24):24
at railo.runtime.functions.orm.EntityNew.call(EntityNew.java:20):20
at scott.handlers.skills_cfc$cf.udfCall(/var/www/scott/handlers/skills.cfc:4):4
at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:103):103
at railo.runtime.type.UDFImpl._call(UDFImpl.java:371):371
at railo.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:275):275
at railo.runtime.ComponentImpl._call(ComponentImpl.java:608):608
at railo.runtime.ComponentImpl._call(ComponentImpl.java:490):490
at railo.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1796):1796
at railo.runtime.tag.Invoke.doComponent(Invoke.java:209):209
at railo.runtime.tag.Invoke.doEndTag(Invoke.java:182):182
at coldbox.system.web.controller_cfc$cf._6(/var/www/coldbox/system/web/Controller.cfc:756):756
at coldbox.system.web.controller_cfc$cf.udfCall(/var/www/coldbox/system/web/Controller.cfc):-1
at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:103):103
at railo.runtime.type.UDFImpl._call(UDFImpl.java:371):371
at railo.runtime.type.UDFImpl.call(UDFImpl.java:284):284
at railo.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:775):775
at railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:723):723
at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1506):1506
at coldbox.system.web.controller_cfc$cf._5(/var/www/coldbox/system/web/Controller.cfc:640):640
at coldbox.system.web.controller_cfc$cf.udfCall(/var/www/coldbox/system/web/Controller.cfc):-1
at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:103):103
at railo.runtime.type.UDFImpl._call(UDFImpl.java:371):371
at railo.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:275):275
at railo.runtime.ComponentImpl._call(ComponentImpl.java:608):608
at railo.runtime.ComponentImpl._call(ComponentImpl.java:490):490
at railo.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1800):1800
at railo.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:749):749
at railo.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1521):1521
at coldbox.system.coldbox_cfc$cf._1(/var/www/coldbox/system/Coldbox.cfc:236):236
at coldbox.system.coldbox_cfc$cf.udfCall(/var/www/coldbox/system/Coldbox.cfc):-1
at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:103):103
at railo.runtime.type.UDFImpl._call(UDFImpl.java:371):371
at railo.runtime.type.UDFImpl.call(UDFImpl.java:284):284
at railo.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:775):775
at railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:723):723
at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1506):1506
at scott.application_cfc$cf.udfCall(/var/www/scott/Application.cfc:44):44
at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:103):103
at railo.runtime.type.UDFImpl._call(UDFImpl.java:371):371
at railo.runtime.type.UDFImpl.call(UDFImpl.java:284):284
at railo.runtime.ComponentImpl._call(ComponentImpl.java:607):607
at railo.runtime.ComponentImpl._call(ComponentImpl.java:490):490
at railo.runtime.ComponentImpl.call(ComponentImpl.java:1781):1781
at railo.runtime.listener.ModernAppListener.call(ModernAppListener.java:346):346
at railo.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:107):107
at railo.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:18):18
at railo.runtime.PageContextImpl.execute(PageContextImpl.java:2255):2255
at railo.runtime.PageContextImpl.execute(PageContextImpl.java:2222):2222
at railo.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:315):315
at railo.loader.servlet.CFMLServlet.service(CFMLServlet.java:29):29
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728):728
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305):305
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210):210
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222):222
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123):123
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472):472
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171):171
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99):99
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118):118
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407):407
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004):1004
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589):589
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310):310
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source):-1
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source):-1
at java.lang.Thread.run(Unknown Source):-1
Let’s see you application.cfc. It looks like maybe the this.datasource line is malformed or something. Also you created the datasource in your Ralio admin correct.
// Enable ORM
this.ormEnabled = true;
// ORM Datasource
this.datasource = "career";
// ORM configuration settings
this.ormSettings = {
// Location of your entities, default is your convention model folder
cfclocation = ["model"],
// Choose if you want ORM to create the database for you or not?
dbcreate = "none",
// Log SQL
logSQL = true,
// Don't flush at end of requests, let Active Entity manage it for you
flushAtRequestEnd = false,
// Don't manage session, let Active Entity manage it for you
autoManageSession = false,
// Active ORM events
eventHandling = true,
// Use the ColdBox WireBox Handler for events
eventHandler = "coldbox.system.orm.hibernate.WBEventHandler"
};
ORMReload();
Well, I guess because I hadn’t seen anywhere where not to put it there (or I missed it, a distinct possibility) I did have it outside the method, but it was balking on the ORMReload().
Where should the ORM settings be located in Application.cfc? Can someone point me to an example or docs?
Re: the ORMReload(), I typically leave that in onRequestStart(), and wrap it in a check for a url variable so that I can reload on demand, as with fwreinit
Thanks Curt (et al) I just came in to tell everyone that I moved everything out of onRequestStart but left ORMReload() behind. It seems to work now. Had I really thought out, it is pretty obvious. I’ll chalk it up to a “long day”
I copied the example from http://wiki.coldbox.org/wiki/Models.cfm (under ORM) exactly because I was having some issues with mine. It works to list and save, however when I try delete I get “Application Execution Exception Error Type: java.lang.NumberFormatException : 0 Error Messages: For input string: “Contact”” and when I edit, it just creates a new record instead of updating the existing one. Any ideas? I know this is something relatively stupid, I’m just not seeing it.