[ColdBox 3.6.1] ORM - datasource [null] doesn't exist error

176 views
Skip to first unread message

SLingle

unread,
Jun 20, 2013, 3:45:40 PM6/20/13
to col...@googlegroups.com
Good afternoon,

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.

Thanks,
Scott

Sana Ullah

unread,
Jun 20, 2013, 4:03:59 PM6/20/13
to col...@googlegroups.com
Hi Scott,

Which CF engine you are using Railo or Adobe ? Also make sure you have correct orm-settings in Application.cfc

Thanks




--
--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org
For Bug Reports, visit https://ortussolutions.atlassian.net/browse/COLDBOX
---
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+u...@googlegroups.com.
To post to this group, send email to col...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 


br...@bradwood.com

unread,
Jun 20, 2013, 4:04:12 PM6/20/13
to col...@googlegroups.com
Can we get the stack trace of the error please?

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: br...@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com 
 
 
--------- Original Message ---------
--

SLingle

unread,
Jun 20, 2013, 8:08:25 PM6/20/13
to col...@googlegroups.com
Sana,

I'm on Railo 4.0.4 and I have the same settings that are on the wiki page with the exception that my datasource is named "career" instead of "contact"

Brad, I'll get the stack trace as soon as I get back in the office tomorrow morning.

Thanks,
Scott

SLingle

unread,
Jun 20, 2013, 8:13:49 PM6/20/13
to col...@googlegroups.com
sorry, wasn't thinking, I have access to it now...
ID:??
LINE:4
Template:/var/www/scott/handlers/skills.cfc
ID:??
LINE:756
Template:/var/www/coldbox/system/web/Controller.cfc
ID:??
LINE:640
Template:/var/www/coldbox/system/web/Controller.cfc
ID:??
LINE:236
Template:/var/www/coldbox/system/Coldbox.cfc
ID:??
LINE:44
Template:/var/www/scott/Application.cfc
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

Curt Gratz

unread,
Jun 20, 2013, 9:31:04 PM6/20/13
to col...@googlegroups.com
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.

Curt


Sent from my Atari

SLingle

unread,
Jun 20, 2013, 9:49:35 PM6/20/13
to col...@googlegroups.com, Curt Gratz
The datasource is ok because I use it in other pages with no problem....Applications.cfc is as follows (or at least the onRequestStart method:

<cffunction name="onRequestStart" returnType="boolean" output="true">
<!--- ************************************************************* --->
<cfargument name="targetPage" type="string" required="true" />
<!--- ************************************************************* --->
<!--- Process A ColdBox Request Only --->
<cfif findNoCase('index.cfm', listLast(arguments.targetPage, '/'))>
<!--- Reload Checks --->
<cfset reloadChecks()>
<!--- Process Request --->
<cfset processColdBoxRequest()>
</cfif>
<!--- WHATEVER YOU WANT BELOW --->
<cfscript>
// 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();
</cfscript>

<cfreturn true>
</cffunction>

Exist~Dissolve

unread,
Jun 20, 2013, 10:22:52 PM6/20/13
to col...@googlegroups.com

Why do you have the ORM settings in onRequeststart()?

SLingle

unread,
Jun 21, 2013, 6:43:57 AM6/21/13
to col...@googlegroups.com
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?

Thx.

Sana Ullah

unread,
Jun 21, 2013, 6:54:01 AM6/21/13
to col...@googlegroups.com

Curt Gratz

unread,
Jun 21, 2013, 6:56:35 AM6/21/13
to col...@googlegroups.com
All of this kind of stuff 

this.datasource = "datasourcename";

// ORM SETTINGS
this.ormEnabled = true;
this.ormSettings = {
cfclocation=["model","modules"],
dbcreate = "update",
secondarycacheenabled = true,
cacheprovider = "ehCache",
logSQL = true,
flushAtRequestEnd = false,
autoManageSession = false,
//savemapping = true,
eventHandling = true,
eventHandler = "model.EventHandler",
skipCFCWithError = false
};
Need to be in the application.cfc "sudo" constructor.  IE just under the start of the component outside of any function. 

I usually add something like this in development in my onRequestStart.

// ORM Reload: REMOVE IN PRODUCTION IF NEEDED
if( structKeyExists(url,"ormReload") ){ ormReload(); }

Curt
From: SLingle <sli...@gmail.com>
Reply-To: "<col...@googlegroups.com>" <col...@googlegroups.com>
Date: Friday, June 21, 2013 5:43 AM
To: "<col...@googlegroups.com>" <col...@googlegroups.com>
Subject: Re: [coldbox:18653] [ColdBox 3.6.1] ORM - datasource [null] doesn't exist error

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?

Thx.

Exist~Dissolve

unread,
Jun 21, 2013, 6:56:45 AM6/21/13
to col...@googlegroups.com
You should put it in the pseudoconstructor of Application.cfc (usually toward the top, outside of any functions). The ColdBox examples sites have examples of this: https://github.com/ColdBox/coldbox-samples/blob/master/applications/ormexample/Application.cfc

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


--
--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org
For Bug Reports, visit https://ortussolutions.atlassian.net/browse/COLDBOX
---
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+u...@googlegroups.com.
To post to this group, send email to col...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
The only thing we learn from history is that we learn nothing from history.

http://singularityconcepts.com

Curt Gratz

unread,
Jun 21, 2013, 6:58:32 AM6/21/13
to col...@googlegroups.com
Ya, pseudoconstructor – its early ok…. :)  And I just typed sudo :)

From: Curt Gratz <gra...@compknowhow.com>
Reply-To: "<col...@googlegroups.com>" <col...@googlegroups.com>
Date: Friday, June 21, 2013 5:56 AM
To: "<col...@googlegroups.com>" <col...@googlegroups.com>
Subject: Re: [coldbox:18654] [ColdBox 3.6.1] ORM - datasource [null] doesn't exist error

All of this kind of stuff 

this.datasource = "datasourcename";

// ORM SETTINGS
this.ormEnabled = true;
this.ormSettings = {
cfclocation=["model","modules"],
dbcreate = "update",
secondarycacheenabled = true,
cacheprovider= "ehCache",
logSQL = true,
flushAtRequestEnd = false,
autoManageSession= false,
//savemapping = true,
eventHandling = true,
eventHandler= "model.EventHandler",
skipCFCWithError= false
};

Exist~Dissolve

unread,
Jun 21, 2013, 6:59:28 AM6/21/13
to col...@googlegroups.com
Lol, sorry for duplicating your answer. I saw the notification pop up literally as I was hitting send :)

SLingle

unread,
Jun 21, 2013, 7:08:49 AM6/21/13
to col...@googlegroups.com
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"

Thanks, 
Scott

SLingle

unread,
Jun 21, 2013, 7:09:41 AM6/21/13
to col...@googlegroups.com
Thanks Joel, see my response to Curt.  I realized this all to late.  Your response sparked me to think about it more.

Scott

SLingle

unread,
Jun 21, 2013, 8:43:48 AM6/21/13
to col...@googlegroups.com
Thanks all, it seems to be working now.  I appreciate the help.  Sana, thanks for the link to the Adobe docs.

Exist~Dissolve

unread,
Jun 21, 2013, 8:48:05 AM6/21/13
to col...@googlegroups.com
Awesome, glad it's working for you!

SLingle

unread,
Jun 21, 2013, 4:27:00 PM6/21/13
to col...@googlegroups.com
Ok, one more question...I swear.

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.

Thanks again,
Scott
Reply all
Reply to author
Forward
0 new messages