ColdBox 4.0 Sample (i18n issue)

I migrated from Railo to Lucee this afternoon, and everything was successful, my muraCMS installation comes up fine.

I wanted to check out ColdBox, so I downloaded it and installed it in my webroot under /coldbox.

I can go to http://localhost/coldbox/ApplicationTemplates/Advanced/ and the page comes up fine.

I downloaded the samples and extracted them to /coldbox/samples.

However, when I go to http://localhost/coldbox/samples, I get this error:

Type: Builder.DSLDependencyNotFoundException
Messages: The DSL Definition {REF={null}, REQUIRED={true}, ARGNAME={}, DSL={id:i18n@cbi18n}, JAVACAST={null}, NAME={i18n}, TYPE={any}, VALUE={null}, SCOPE={variables}} did not produce any resulting dependency The target requesting the dependency is: ‘coldbox.samples.handlers.Samples’

I thought this was because I was missing the i18n module, so I downloaded it from ForgeBox, extracted it to /coldbox/modules/cbi18n but the error persists.

Any advice?

Disregard this. As soon as I restarted tomcat8 it started working. And the folder I put cbi18n was /coldbox/system/modules not /coldbox/modules.

It wouldn’t go under /coldbox/modules/cbi18n, it would be /coldbox/samples/modules/cbi18n

The i18n module is already listed as a dependency in the box.json, but you would need to run “install” in the samples directory with CommandBox to install it.

I see the modules folder has been added .gitignore. That was probably an oversight. There’s a really good argument to be made that the samples should not ship with their modules, and you should “install” each sample app, but most CF devs aren’t in that mindset.

For what it’s worth, all the rest of the sample apps should have their modules pre-installed. I think the main app is the only one that had them ignored. Also, fair warning, none of the sample apps that use the SES interceptor will work on Lucee (or Railo) because Adobe adds special magic to Tomcat to make the .cfm/ servlet mapping possible. You’ll need to add servlet mappings for each of those apps, or set up web roots in each of the application folders. In my opinion this is where the embedded server in CommandBox makes this way, way easy. Just CD into the folder and type “start”. Of course, CommandBox still uses Railo at the moment. We are currently working on our Lucee support.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

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

Brad, the module would go in that folder assuming I didn’t want to install it globally, correct?

Also, I was just about to ask why the following gives me a 404:

http://localhost/coldbox/samples/applications/ColdBoxSES/index.cfm/home

This obviously works:

http://localhost/coldbox/samples/applications/ColdBoxSES/index.cfm

It seems you covered it in your response. So my tomcat8 web.xml has the following mappings:

CFMLServlet *.cfc *.cfm *.cfml /index.cfc/* /index.cfm/* /index.cfml/*

Would I just need to add one that is /coldbox/samples/applications/ColdBoxSES/index.cfm/*?

Hey, looky there, I never realized Luis did ticket COLDBOX-250 for global modules. We should add that to the what’s new guide!

So, yeah I guess you can put the module there now :slight_smile:

And yes, on your servlet mappings. That should get it working after a Tomcat restart.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

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

Hi Brad

Been struggling with a similar issue relating to the cbi18n module for coldbox 4. I have absolutely no issues injecting the resourceService into handlers via property injection using: property name=“resourceService” inject=“id:resourceService@cbi18n”; However, when attempting to use the resource service in a regular service object that happens to extends the cborm.models.VirtualEntityService, I get the following error error:

The DSL Definition {REF={null}, REQUIRED={true}, ARGNAME={}, DSL={id:resourceService@cbi18n}, JAVACAST={null}, NAME={resourceService}, TYPE={any}, VALUE={null}, SCOPE={variables}} did not produce any resulting dependency.
Detail: The target requesting the dependency is: ‘UserService@pc’.

For some odd reason the: instance.injector.containsInstance( modelName ) (469) in ioc/Builder.cfc is not finding the injected instance in the getModelDSL function. Oddly, the injection has worked on other service layer objects, and at other times just digs its heels in. My service component is pretty standard:

component accessors=“true” extends=“cborm.models.VirtualEntityService” singleton{

property name=“resourceService” inject=“id:resourceService@cbi18n”;

public UserService function init(){
super.init(entityName=“User”);
}
…Bla, bla, bla

}

Additional Info:

  1. The i18n settings are configured at a module level.
  2. The cbi18n module is living in a bundle folder.
  3. Have a custom interceptor and security interceptor running in the background.

Can you please give me some insight as to why this is happening. It’s driving me around the bend!

Regards
Mark

The models are probably being created before the modules load. Interceptors, for instance, are loaded prior to modules. If your security interceptor loads these models, it would cause Wirebox to create them prior to the ORM modules’ mappings being created.

I would recommend working around this chicken/egg issue with a provider, which will delay creation as long as the ORM objects are not actually needed to init the interceptor.

property name=“resourceService” inject=“provider:id:resourceService@cbi18n”;

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

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