[CB 4.3] cborm error: The parameter entityName to function list is required but was not passed in."

Hi guys,

First time using ColdBox and I’m enjoying it so far as someone who came up learning build tools like Node.js. Commandbox is a life saver for someone at my skill level.

I’m getting an error with the following stack trace when interacting with my Users table through cborm, going into an MSSQL DB:

`

Stack Trace:

The parameter entityName to function list is required but was not passed in.
at lucee.runtime.type.UDFImpl.defineArguments(UDFImpl.java:179):179
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:326):326
at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:216):216
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:643):643
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:532):532
at lucee.runtime.SuperComponent.callWithNamedValues(SuperComponent.java:90):90
at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:774):774
at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1609):1609
at models.virtualentityservice_cfc$cf.udfCall1(/cborm/models/VirtualEntityService.cfc:100):100
at models.virtualentityservice_cfc$cf.udfCall(/cborm/models/VirtualEntityService.cfc):-1
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:111):111
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:328):328
at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:216):216
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:643):643
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:524):524
at lucee.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1778):1778
at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:774):774
at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1609):1609
at handlers.users_cfc$cf.udfCall(/handlers/Users.cfc:37):37
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:111):111
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:328):328
at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:216):216
at lucee.runtime.type.scope.UndefinedImpl.callWithNamedValues(UndefinedImpl.java:775):775
at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:774):774
at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1609):1609
at coldbox.system.eventhandler_cfc$cf.udfCall(/coldbox/system/EventHandler.cfc:85):85
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:111):111
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:328):328
at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:216):216
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:643):643
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:524):524
at lucee.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1778):1778
at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:774):774
at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1609):1609
at coldbox.system.web.controller_cfc$cf.udfCall3(/coldbox/system/web/Controller.cfc:795):795
at coldbox.system.web.controller_cfc$cf.udfCall(/coldbox/system/web/Controller.cfc):-1
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:111):111
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:328):328
at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:216):216
at lucee.runtime.type.scope.UndefinedImpl.callWithNamedValues(UndefinedImpl.java:775):775
at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:774):774
at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1609):1609
at coldbox.system.web.controller_cfc$cf.udfCall2(/coldbox/system/web/Controller.cfc:633):633
at coldbox.system.web.controller_cfc$cf.udfCall(/coldbox/system/web/Controller.cfc):-1
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:111):111
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:328):328
at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:216):216
at lucee.runtime.type.scope.UndefinedImpl.callWithNamedValues(UndefinedImpl.java:775):775
at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:774):774
at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1609):1609
at coldbox.system.web.controller_cfc$cf.udfCall2(/coldbox/system/web/Controller.cfc:425):425
at coldbox.system.web.controller_cfc$cf.udfCall(/coldbox/system/web/Controller.cfc):-1
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:111):111
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:328):328
at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:216):216
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:643):643
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:524):524
at lucee.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1778):1778
at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:774):774
at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1609):1609
at coldbox.system.bootstrap_cfc$cf.udfCall1(/coldbox/system/Bootstrap.cfc:200):200
at coldbox.system.bootstrap_cfc$cf.udfCall(/coldbox/system/Bootstrap.cfc):-1
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:111):111
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:328):328
at lucee.runtime.type.UDFImpl.call(UDFImpl.java:229):229
at lucee.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:766):766
at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:743):743
at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1599):1599
at coldbox.system.bootstrap_cfc$cf.udfCall1(/coldbox/system/Bootstrap.cfc:360):360
at coldbox.system.bootstrap_cfc$cf.udfCall(/coldbox/system/Bootstrap.cfc):-1
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:111):111
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:328):328
at lucee.runtime.type.UDFImpl.call(UDFImpl.java:229):229
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:642):642
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:524):524
at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1761):1761
at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:743):743
at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1599):1599
at application_cfc$cf.udfCall(/Application.cfc:66):66
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:111):111
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:328):328
at lucee.runtime.type.UDFImpl.call(UDFImpl.java:229):229
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:642):642
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:524):524
at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1761):1761
at lucee.runtime.listener.ModernAppListener.call(ModernAppListener.java:414):414
at lucee.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:133):133
at lucee.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:37):37
at lucee.runtime.PageContextImpl.execute(PageContextImpl.java:2271):2271
at lucee.runtime.PageContextImpl.execute(PageContextImpl.java:2234):2234
at lucee.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:456):456
at lucee.loader.servlet.CFMLServlet.service(CFMLServlet.java:47):47
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790):790
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85):85
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129):129
at org.cfmlprojects.regexpathinfofilter.RegexPathInfoFilter.doFilter(RegexPathInfoFilter.java:47):47
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61):61
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131):131
at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84):84
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62):62
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36):36
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43):43
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43):43
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:274):274
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchToPath(ServletInitialHandler.java:209):209
at io.undertow.servlet.spec.RequestDispatcherImpl.forwardImpl(RequestDispatcherImpl.java:221):221
at io.undertow.servlet.spec.RequestDispatcherImpl.forwardImplSetup(RequestDispatcherImpl.java:147):147
at io.undertow.servlet.spec.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:111):111
at org.cfmlprojects.regexpathinfofilter.RegexPathInfoFilter.doFilter(RegexPathInfoFilter.java:45):45
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61):61
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131):131
at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84):84
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62):62
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36):36
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131):131
at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57):57
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43):43
at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46):46
at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64):64
at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60):60
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77):77
at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43):43
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43):43
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43):43
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292):292
at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81):81
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138):138
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135):135
at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48):48
at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43):43
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272):272
at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81):81
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104):104
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:211):211
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:809):809
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
`

Welcome aboard my friend!!

I need to see the offending call source as well. How are you calling the
services?

Welcome Roy!

As Luis said, it would be helpful to see the component you’re trying to call list() on. You usually see that error, though, when trying to use the BaseORMService directly, without using an instantiated VirtualEntityService or by having incorrect inheritance in your entity. It’s likely an inheritance issue.

Entities should all extend cborm.models.ActiveEntity. Then, calling list() will already have the entityName scoped.

To use a VES, you’ll need to have an init() method that specifies the entityName:

function init(){

// init super class// init it

super.init( entityName=“MyEntityName” );

return this;

}

With either the VES or ActiveEntity, once inheritance is correct, list() will function without an entityName argument.

HTH,

Jon

(2nd attempt on Tag Context, first was messy):

My models/Users.cfc:

component persistent=“true” table=“xnetdb.users” extends=“modules.cborm.models.ActiveEntity” {

// Primary Key
property name=“id” fieldtype=“id” column=“id” generator=“native” setter=“false”;

// Properties
property name=“userName” ormtype=“string”;
property name=“firstName” ormtype=“string”;
property name=“lastName” ormtype=“string”;
property name=“email” ormtype=“string”;
property name=“isActive” ormtype=“string”;
property name=“passwordHash” ormtype=“string”;
property name=“passwordSalt” ormtype=“string”;

// Validation
this.constraints = {

};

// Constructor
function init(){
return this;
}
}

My handlers/Users.cfc:

component{

// Dependency Injection

// OPTIONAL HANDLER PROPERTIES
this.prehandler_only = “”;
this.prehandler_except = “”;
this.posthandler_only = “”;
this.posthandler_except = “”;
this.aroundHandler_only = “”;
this.aroundHandler_except = “”;
// REST Allowed HTTP Methods Ex: this.allowedMethods = {delete=‘POST,DELETE’,index=‘GET’}
this.allowedMethods = {};

/**
IMPLICIT FUNCTIONS: Uncomment to use
function preHandler( event, rc, prc, action, eventArguments ){
}
function postHandler( event, rc, prc, action, eventArguments ){
}
function aroundHandler( event, rc, prc, targetAction, eventArguments ){
// executed targeted action
arguments.targetAction( event );
}
function onMissingAction( event, rc, prc, missingAction, eventArguments ){
}
function onError( event, rc, prc, faultAction, exception, eventArguments ){
}
function onInvalidHTTPMethod( event, rc, prc, faultAction, eventArguments ){
}
*/

function index(event,rc,prc){
prc.users = entityNew(“Users”).list(sortOrder=“lastName”,asQuery=false);
event.setView(“users/index”);
}

function editor(event,rc,prc){
event.paramValue(“id”,0);
prc.user = entityNew(“users”).get( rc.id );
event.setView(“users/editor”);
}

function delete(event,rc,prc){
event.paramValue(“id”,0);
entityNew(“Users”).deleteByID( rc.id );
flash.put( “notice”, “User Removed!” );
setNextEvent(“users”);
}

function save(event,rc,prc){
event.paramValue(“id”,0);
var user = populateModel( entityNew(“Users”).get( rc.id ) );
if( user.isValid() ){
user.save();
flash.put( “notice”, “User Saved!” );
setNextEvent(“users”);
}
else{
flash.put( “errors”, users.getValidationResults().getAllErrors() );
return editor(event,rc,prc);
}
}

}

And finally, my Application.cfc:

component{
// Application properties
this.name = hash( getCurrentTemplatePath() );
this.sessionManagement = true;
this.sessionTimeout = createTimeSpan(0,0,30,0);
this.setClientCookies = true;

// Java Integration
this.javaSettings = {
loadPaths = [ “.\lib” ],
loadColdFusionClassPath = true,
reloadOnChange= false
};

this.datasources[“xnetdb”] = {
class: ‘com.microsoft.sqlserver.jdbc.SQLServerDriver’,
bundleName: ‘mssqljdbc4’,
bundleVersion: ‘4.0.2206.100’,
connectionString: ‘jdbc:sqlserver://server.mydomain.com:1433;DATABASENAME=mydb;sendStringParametersAsUnicode=true;SelectMethod=direct’,

username: ‘user [obfuscated for this post]’,
password: “encrypted:hash[obfuscated for this post]”
};

this.ormEnabled = true;
this.datasource = “myDB”;
this.ormSettings = {
cfclocation = “models”,
dbcreate = “update”,
dialect = “MicrosoftSQLServer”,
logSQL = true,
flushAtRequestEnd = false,
autoManageSession = false,
eventHandling = true,
eventHandler = “modules.cborm.models.EventHandler”
};

// COLDBOX STATIC PROPERTY, DO NOT CHANGE UNLESS THIS IS NOT THE ROOT OF YOUR COLDBOX APP
COLDBOX_APP_ROOT_PATH = getDirectoryFromPath( getCurrentTemplatePath() );
// The web server mapping to this application. Used for remote purposes or static purposes
COLDBOX_APP_MAPPING = “”;
// COLDBOX PROPERTIES
COLDBOX_CONFIG_FILE = “”;
// COLDBOX APPLICATION KEY OVERRIDE
COLDBOX_APP_KEY = “”;

// application start
public boolean function onApplicationStart(){
application.cbBootstrap = new coldbox.system.Bootstrap( COLDBOX_CONFIG_FILE, COLDBOX_APP_ROOT_PATH, COLDBOX_APP_KEY, COLDBOX_APP_MAPPING );
application.cbBootstrap.loadColdbox();
return true;
}

// application end
public void function onApplicationEnd( struct appScope ){
arguments.appScope.cbBootstrap.onApplicationEnd( arguments.appScope );
}

// request start
public boolean function onRequestStart( string targetPage ){
// Process ColdBox Request
application.cbBootstrap.onRequestStart( arguments.targetPage );

return true;
}

public void function onSessionStart(){
application.cbBootStrap.onSessionStart();
}

public void function onSessionEnd( struct sessionScope, struct appScope ){
arguments.appScope.cbBootStrap.onSessionEnd( argumentCollection=arguments );
}

public boolean function onMissingTemplate( template ){
return application.cbBootstrap.onMissingTemplate( argumentCollection=arguments );
}

}

And, of course, thanks for your time...

Roy,

Use Wirebox to obtain/instantiate the entity:

getInstance(“Users”).list(sortOrder=“lastName”,asQuery=false);

That should fix the issue. Built-in CFML ORM methods like entityNew() should not be used when you are using Coldbox CBORM, as the Wirebox “magic” does not happen and weird errors like the one you are encountering can occur.

Jon

Also, it looks like Jon said that you are trying the Active Entity approach, thus your entities must inherit from the base active entity class in order for the cborm module to kick in.

https://github.com/coldbox-modules/cbox-cborm/wiki/Active-Entity

Ah, ok. I was calling the wrong stack basically… thanks for your help!

Ah, so I was assuming that Wirebox was part of the base Coldbox build. I think this is why some of my dependency injection wasn’t working…

It is part of the Coldbox core. If you’re not instantiating those objects with Wirebox’s getInstance() method ( formerly known as getModel() ), however, you’ll run in to issues with null injected properties.

If you’re running in to other DI-related issues, feel free to ask any additional questions.

Jon