Can't find component [cborm.models.EventHandler]

CB Team: I’m really struggling. Trying to setup a new site, and set it up with ContentBox, too. I’ve gone through the steps here (which are a bit … lacking. No mention of having to put a datasource or dialect values.)
https://contentbox.ortusbooks.com/getting-started/installation/existing-coldbox-application

When it comes down to attempting to instantiate the EventHandler in the ORM setup, it fails. I started debugging. Here’s my current code, all that should matter:

// LOCATION MAPPINGS
this.mappings[ “/contentbox” ] = COLDBOX_APP_ROOT_PATH & “modules/contentbox”;
// THE LOCATION OF THE ORM MODULE
this.mappings[ “/cborm” ] = this.mappings[ “/contentbox” ] & ‘\modules\contentbox-deps\modules\cborm’;

writeOutput(‘Lucee Version: Lucee 5.3.3.62
’); // Hardcoded

writeDump(“ExpandPath(this.mappings[ ‘/cborm’ ])”);
writeDump(expandPath(this.mappings[ “/cborm” ]));
writeOutput(’
’);

writeDump(‘File exists? ’ & expandPath(this.mappings[ “/cborm” ]) & ‘models\EventHandler.cfc’ & ‘?’);
writeDump(fileExists(expandPath(this.mappings[ “/cborm” ]) & ‘models\EventHandler.cfc’));
writeOutput(’
’);

writeDump(“Try: createObject(‘component’, ‘cborm.models.EventHandler’) …”);
x = createObject(‘component’, ‘cborm.models.EventHandler’)
writeDump(x);
abort;

You can see that I have the mappings, by the fact the expandPath works. I can confirm that the file exists, and specifically using the mapping to do so.

But when I try to directly instantiate the object (that was failing in the ORM setup, doing manually here), it fails.

As best I can tell, there’s one of two things happening here:

a) Does it not like the dash in “contentbox-deps” ?

b) The path is just too darn long?

I have tried this with my already installed Lucee, as well as trying it with the embedded “server start” and port from CommandBox. Both fail in exactly the same way.

I’m at wit’s end. Almost ready to head off to Wordpress, ugh.

Hi CaptainPalapa

Its seems like mappings do not work in the constructor of the application.cfc. I did a quick test and it seems like mapping can only be used after the application.cfc has been instantiated. (remember, the application.cfc is ran and instantiated on every request).

This works, see line 75 on the attachment.

What was the original problem you were having with contentbox?

Regards
Ryan

Application.cfc (3.68 KB)

The original issue started with the ORM setup complaining that it had no datasource. (That was my statement earlier about the docs being a little off.)

I copied the datasource info from Lucee admin, put the script flavor in the pre-constructor of the application.cfc.

Then I modified the ORM setup to be:
// ORM SETTINGS
this.ormEnabled = true;
this.ormSettings = {
datasource = ‘cborm’,
dialect = ‘MicrosoftSQLServer’,

The very next thing that happened was the complaint about not being able to find the cborm.models.EventHandler component. That’s when I began trying to instantiate directly.

I took all my test code out (that you moved in your copy of the app.cfc) and restarted Lucee. The next attempt resulted in a completely different error.

The DSL provided was not valid: {ref={null}, required={true}, argName={}, dsl={coldbox:moduleConfig:contentbox-custom}, javaCast={null}, name={customModuleSettings}, type={any}, value={null}, scope={variables}}

The module requested: contentbox-custom does not exist in the loaded modules. Loaded modules are cbmarkdown,HTMLHelper,cbstorages,cbfeeds,cbjavaloader,cbmessagebox,cborm,contentbox-email-twofactor,contentbox-sitemap,forgeboxsdk,cbmailservices,contentbox-deps,cbsecurity,BCrypt,contentbox,contentbox-ckeditor,contentbox-ui,cbantisamy,cbi18n,cbemoji,contentbox-admin,contentbox-markdowneditor,contentbox-security,cbvalidation,contentbox-filebrowser
StacktraceThe Error Occurred in
E:\Development\DWO\coldbox\system\ioc\dsl\ColdBoxDSL.cfc: line 168

166: type = “ColdBoxDSL.InvalidDSL”,
167: message = “The DSL provided was not valid: #arguments.definition.toString()#”,
168: detail="The module requested: #thisLocationKey# does not exist in the loaded modules. Loaded modules are #structKeyList(moduleSettings)#"
169: );
170: }

called from E:\Development\DWO\coldbox\system\ioc\dsl\ColdBoxDSL.cfc: line 58
called from E:\Development\DWO\coldbox\system\ioc\Builder.cfc: line 410
called from E:\Development\DWO\coldbox\system\ioc\Injector.cfc: line 897
called from E:\Development\DWO\coldbox\system\ioc\Injector.cfc: line 653
called from E:\Development\DWO\coldbox\system\ioc\scopes\Singleton.cfc: line 78
called from E:\Development\DWO\coldbox\system\ioc\Injector.cfc: line 370
called from E:\Development\DWO\coldbox\system\ioc\Builder.cfc: line 614
called from E:\Development\DWO\coldbox\system\ioc\Builder.cfc: line 436
called from E:\Development\DWO\coldbox\system\ioc\Injector.cfc: line 897
called from E:\Development\DWO\coldbox\system\ioc\Injector.cfc: line 653
called from E:\Development\DWO\coldbox\system\ioc\scopes\Singleton.cfc: line 78
called from E:\Development\DWO\coldbox\system\ioc\Injector.cfc: line 370
etc…

sdfsd

Do you have fwreinit=1 appended to your url?

In this case, no. I had restarted Lucee completely.

(I’m really familiar with Coldbox, been using it for many, many years. 12 or so?)

The only reason I asked is because I got the same error you are getting now and I removed the fwreinit flag and now I am having another issue where the application is in a redirect loop :{

Im knocking off work I run through this again when I get home.

Regards
Ryan

Hi Will,

I am not sure why you always get the fun errors!

You can see all our integration and unit tests and they all pass using mappings. So I am not sure why you would get this exception. Basically when the app boots up, hibernate interceptors ar loaded by the CFML engine. So the error comes from the hibernate factory loading that CFML does.

Why don’t you use CommnadBox to generate a new site with ContentBox and test it:

install contentbox-installer
server start

https://contentbox.ortusbooks.com/getting-started/installation/commandbox-installation

@Luis – I stepped through all the installs using CommandBox, I thought I did it correctly. Is there a Coldbox/ContentBox download ready to go that’s already integrated?

Did you use commandbox?

Luis Majano
CEO
Ortus Solutions, Corp

P/F: 1-888-557-8057

Yes. I said that. “I stepped through all the installs using CommandBox”

Well, I can’t replicate your issue

Here is a video with me installing it via the instructions:
https://vimeo.com/389546975

Please watch it and let me know where you are diverging?