Error when trying to run new ContentBox Site

Was trying to install a ContentBox 2.0.1 site into a sub folder of an existing ColdFusion 11 site Update 5 on Windows 2012 R2 IIS 8.5.

I got to the point of the tables being built for me in SQL Express 2012 and got this error. Anyone have any ideas?

Error building: settingService@cb -> CFC coldbox.system.orm.hibernate.WBEventHandler does not implement the interface CFIDE.orm.IEventHandler. The preFlush method is not implemented by the component or it is declared as private. with constructor arguments: {}

I found this link that talks about the error specifically. Can someone please tell me the correct arguments and the syntax to pass as arguments to the preFlush function?

Here is the error now.

Error building: settingService@cb -> Function argument mismatch. The preFlush function does not specify the same arguments or arguments in the same order in the coldbox.system.orm.hibernate.WBEventHandler ColdFusion component and the CFIDE.orm.IEventHandler ColdFusion interface. with constructor arguments: {}

https://bugbase.adobe.com/index.cfm?event=bug&id=3753750

you need to add the new events to your ORM Event Handler.

What file is that Andrew?

It is defined in your Application.cfc ORM settings.

Thanks Andrew, in my case it is at eventHandler = “modules.contentbox.model.system.EventHandler”

It was an empty component and I added this.

public void function preFlush(any entity){
}

public void function postFlush(any entity){
}

I suspect that is wrong?

I get the same error fwreinted and no change

Andrew, what did you do to get this working other than add those two methods to the EventHandler and it does not work at all.

Reporting back. I stood up a vm running windows 2012 R2 and ColdFusion 10 over the weekend to verify that the issue was with ColdFusion 11. I was able to create ContentBox withut any issues. So, the fault lies with the way ColdFusion 11 is put together. It says this on the Adobe release notes for CF11 and it still has not been fixed. They (Adobe) classify it as a known issue rather than a bug which should be fixed.

https://helpx.adobe.com/coldfusion/release-note/coldfusion-11-release-notes.html

3753750 - ORM application event handlers that implement the interface CFIDE.orm.IEventHandler will fail with the error “CFC xxxx does not implement the interface CFIDE.orm.IEventHandler”. You have to add two new functions preFlush and postFlush to your event handlers.

What can be done to fix ContentBox so it will work in CF11?

is it supposed to be entities not entity as the argument name?

public void function preFlush(any entities){};
public void function postFlush(any entities){};

You could also try adding it to /coldbox/system/orm/hibernate/EventHandler.cfc directly instead. Probably not ideal, but it had worked for me previously since that CFC is the one that implements=“CFIDE.orm.IEventHandler”

Hi Tim,

Those methods are already in the file coldbox.system.orm.hibernate.EventHandler.cfc they are not empty there is a call to announceInterception(“ORMPreFlush”, {entities=arguments.entities})

Thanks,

GM

George,

I just tried this on my ColdFusion 11 update 5 with no issues George.

Maybe your Application.cfc is not right:

// ColdBox Application Specific, Modify if you need to
COLDBOX_APP_ROOT_PATH = getDirectoryFromPath( getCurrentTemplatePath() );
COLDBOX_APP_MAPPING = “”;
COLDBOX_CONFIG_FILE = “”;
COLDBOX_APP_KEY = “”;
// LOCATION MAPPINGS
this.mappings["/contentbox"] = COLDBOX_APP_ROOT_PATH & “modules/contentbox”;
this.mappings["/contentbox-ui"] = COLDBOX_APP_ROOT_PATH & “modules/contentbox-ui”;
this.mappings["/contentbox-admin"] = COLDBOX_APP_ROOT_PATH & “modules/contentbox-admin”;
// THE LOCATION OF EMBEDDED COLDBOX
this.mappings["/coldbox"] = COLDBOX_APP_ROOT_PATH & “coldbox”;

// THE DATASOURCE FOR CONTENTBOX MANDATORY
this.datasource = “contentbox”;
// ORM SETTINGS
this.ormEnabled = true;
this.ormSettings = {
// ENTITY LOCATIONS, ADD MORE LOCATIONS AS YOU SEE FIT
cfclocation=[ “model”, “modules” ],
// THE DIALECT OF YOUR DATABASE OR LET HIBERNATE FIGURE IT OUT, UP TO YOU TO CONFIGURE
//dialect = “MySQLwithInnoDB”,
// DO NOT REMOVE THE FOLLOWING LINE OR AUTO-UPDATES MIGHT FAIL.
dbcreate = “update”,
// FILL OUT: IF YOU WANT CHANGE SECONDARY CACHE, PLEASE UPDATE HERE
secondarycacheenabled = false,
cacheprovider = “ehCache”,
// ORM SESSION MANAGEMENT SETTINGS, DO NOT CHANGE
logSQL = true,
flushAtRequestEnd = false,
autoManageSession = false,
// ORM EVENTS MUST BE TURNED ON FOR CONTENTBOX TO WORK
eventHandling = true,
eventHandler = “modules.contentbox.model.system.EventHandler”,
// THIS IS ADDED SO OTHER CFML ENGINES CAN WORK WITH CONTENTBOX
skipCFCWithError = true
};

Luis Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com
P/F: 1-888-557-8057
Direct: (909) 248-3408

ColdBox Platform: http://www.coldbox.org

ContentBox Platform: http://www.gocontentbox.org
Linked In: http://www.linkedin.com/pub/3/731/483

Social: twitter.com/ortussolutions | twitter.com/coldbox | twitter.com/lmajano | twitter.com/gocontentbox

Hi Luis,

Here is what I have in my Application.cfc

// ColdBox Application Specific, Modify if you need to
COLDBOX_APP_ROOT_PATH = getDirectoryFromPath( getCurrentTemplatePath() );
COLDBOX_APP_MAPPING = “”;
COLDBOX_CONFIG_FILE = “”;
COLDBOX_APP_KEY = “”;
// LOCATION MAPPINGS
this.mappings["/contentbox"] = COLDBOX_APP_ROOT_PATH & “modules/contentbox”;
this.mappings["/contentbox-ui"] = COLDBOX_APP_ROOT_PATH & “modules/contentbox-ui”;
this.mappings["/contentbox-admin"] = COLDBOX_APP_ROOT_PATH & “modules/contentbox-admin”;
// THE LOCATION OF EMBEDDED COLDBOX
this.mappings["/coldbox"] = COLDBOX_APP_ROOT_PATH & “coldbox”;

// THE DATASOURCE FOR CONTENTBOX MANDATORY
this.datasource = “clientblog”;
// ORM SETTINGS
this.ormEnabled = true;
this.ormSettings = {
// ENTITY LOCATIONS, ADD MORE LOCATIONS AS YOU SEE FIT
cfclocation=[ “model”, “modules” ],
// THE DIALECT OF YOUR DATABASE OR LET HIBERNATE FIGURE IT OUT, UP TO YOU TO CONFIGURE
//dialect = “MySQLwithInnoDB”,
// DO NOT REMOVE THE FOLLOWING LINE OR AUTO-UPDATES MIGHT FAIL.
dbcreate = “update”,
// FILL OUT: IF YOU WANT CHANGE SECONDARY CACHE, PLEASE UPDATE HERE
secondarycacheenabled = false,
cacheprovider = “ehCache”,
// ORM SESSION MANAGEMENT SETTINGS, DO NOT CHANGE
logSQL = true,
flushAtRequestEnd = false,
autoManageSession = false,
// ORM EVENTS MUST BE TURNED ON FOR CONTENTBOX TO WORK
eventHandling = true,
eventHandler = “modules.contentbox.model.system.EventHandler”,
// THIS IS ADDED SO OTHER CFML ENGINES CAN WORK WITH CONTENTBOX
skipCFCWithError = true

There is no eventhandler setup there George and also, when you make changes to the ORM a fwreinit is not good enough. You either have to change the Application name or restart ColdFusion itself.

I just had a quick look thought the reloadChecks() and I see no ORM restarting…

Please try that and make sure you’re Application.cfc is pointing to the right event handler and see how you go.

Hi Andrew, when I posted this I did not get everything. Now I have it. Now to clarify something.

Where should I put the preFlush and postFlush methods? In the modules.contentbox.model.system.EventHandler or the coldbox.system.orm.Hibernate.EventHandler?
Should the argument geting passed in the preFlush be enity or entities?

// ColdBox Application Specific, Modify if you need to
COLDBOX_APP_ROOT_PATH = getDirectoryFromPath( getCurrentTemplatePath() );
COLDBOX_APP_MAPPING = “”;
COLDBOX_CONFIG_FILE = “”;
COLDBOX_APP_KEY = “”;
// LOCATION MAPPINGS
this.mappings["/contentbox"] = COLDBOX_APP_ROOT_PATH & “modules/contentbox”;
this.mappings["/contentbox-ui"] = COLDBOX_APP_ROOT_PATH & “modules/contentbox-ui”;
this.mappings["/contentbox-admin"] = COLDBOX_APP_ROOT_PATH & “modules/contentbox-admin”;
// THE LOCATION OF EMBEDDED COLDBOX
this.mappings["/coldbox"] = COLDBOX_APP_ROOT_PATH & “coldbox”;

// THE DATASOURCE FOR CONTENTBOX MANDATORY
this.datasource = “clientblog”;
// ORM SETTINGS
this.ormEnabled = true;
this.ormSettings = {
// ENTITY LOCATIONS, ADD MORE LOCATIONS AS YOU SEE FIT
cfclocation=[ “model”, “modules” ],
// THE DIALECT OF YOUR DATABASE OR LET HIBERNATE FIGURE IT OUT, UP TO YOU TO CONFIGURE
//dialect = “MySQLwithInnoDB”,
// DO NOT REMOVE THE FOLLOWING LINE OR AUTO-UPDATES MIGHT FAIL.
dbcreate = “update”,
// FILL OUT: IF YOU WANT CHANGE SECONDARY CACHE, PLEASE UPDATE HERE
secondarycacheenabled = false,
cacheprovider = “ehCache”,
// ORM SESSION MANAGEMENT SETTINGS, DO NOT CHANGE
logSQL = true,
flushAtRequestEnd = false,
autoManageSession = false,
// ORM EVENTS MUST BE TURNED ON FOR CONTENTBOX TO WORK
eventHandling = true,
eventHandler = “modules.contentbox.model.system.EventHandler”,
// THIS IS ADDED SO OTHER CFML ENGINES CAN WORK WITH CONTENTBOX
skipCFCWithError = true

Thanks,

George Murphy

The event handler that is defined in Application.cfc points to YOUR event Handler and it should extend the one in the framework. But to be honest I thought ContentBox 2.0 has this in it already.

I don’t recall adding it thought.

/**

  • preSave called by ColdBox Base service before save() calls
    */
    public void function preSave(any entity){
    announceInterception(“ORMPreSave”, {entity=arguments.entity});
    }

/**

  • postSave called by ColdBox Base service after transaction commit or rollback via the save() method
    */
    public void function postSave(any entity){
    announceInterception(“ORMPostSave”, {entity=arguments.entity});
    }

/**

  • Called before the session is flushed.
    */
    public void function preFlush(any entities){
    announceInterception(“ORMPreFlush”, {entities=arguments.entities});
    }

/**

  • Called after the session is flushed.
    */
    public void function postFlush(any entities){
    announceInterception(“ORMPostFlush”, {entities=arguments.entities});
    }

/**

  • Get the system Event Manager
    */
    public any function getEventManager(){
    return getWireBox().getEventManager();
    }

I think you might have an old version of ColdBox running on this.

This is cf11 compat totally.

/**

Luis, I don’t think that is CF11 friendly as it has no pre/post flush.

it has it. I thought that same thing at first, but it just got folded automatically in my mail reader due to the comments being interpreted as a thread divider due to the asterisks, etc… Gists or pastebins (pastebin.com) might help avoid the email clients from mangling the code.

Well I am confused why Luis would say mine is old, when it is the same thing then!!!

As I downloaded mine from the ContentBox website, that would mean the code there is old too.