look ma, no xml! revision 2843 challenge

When I updated my CB tonight, an app I’m working on suddenly began dying in the early stages of initialization. Since my svn update included about the last six revisions, I reverted to where I was before I did the update, then stepped through the revision updates one at a time, testing my app after each one. It worked fine all the way until I updated to revision 2843. I attempted to figure out exactly why, but after a half hour of poking around in the guts of CB, figured I’d leave it to the experts to determine if something was perhaps overlooked in the code to go “sans xml”, or if maybe there’s something I need to change in my app for the latest revision to work correctly (I’m still using xml).

Here is my error and stack trace:

The value returned from the getAppLoader function is not of type coldbox.system.web.loader.AbstractApplicationLoader.

If the component name is specified as a return type, its possible that a definition file for the component cannot be found or is not accessible.

The error occurred in D:\Inetpub\wwwroot\coldbox\system\interceptors\EnvironmentControl.cfc: line 34
Called from D:\Inetpub\wwwroot\coldbox\system\services\InterceptorService.cfc: line 153
Called from D:\Inetpub\wwwroot\coldbox\system\services\InterceptorService.cfc: line 68
Called from D:\Inetpub\wwwroot\coldbox\system\services\InterceptorService.cfc: line 42
Called from D:\Inetpub\wwwroot\coldbox\system\services\LoaderService.cfc: line 78
Called from D:\Inetpub\wwwroot\coldbox\system\Coldbox.cfc: line 71
Called from D:\Inetpub\wwwroot\coldbox\system\Coldbox.cfc: line 92
Called from D:\Inetpub\wwwroot\DreamBlog\Application.cfc: line 48

32 : 			
33 : 			// App Loader
**34 : 			instance.appLoader = controller.getLoaderService().getAppLoader();**
35 : 			
36 : 			// Verify that the configFile propety is set

Doug did you restart your engine toclear the memory stubs

GOt it!!

And committ it, nice oversight on my part.

By the way, loading a coldbox app with a cfc instead of xml, makes things start almost instant.
Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Luis, when you say ‘restarting the engine’ are you referring to restarting cf itself? If so, no, I didn’t do that; I only restarted the framework.

Glad you tracked down the issue…I’ll try updating again today.

Question: does this new change only apply to the coldbox.XML, or can I convert my other config files too? And, how far back cf version-wise is this change compatible? (do I need cf 9?)

Thanks Luis!

Hi Doug,

The new coldbox.cfc config will be compatible with CF8 and above.

Thanks
Sana

yes, cf8 and above. The Coldbox.cfc can kickstart applications now with EMBEDDED environment control

It has environment control included, no more interceptor.

All you do is declare an environments struct with keys as names of environments and values as a list of regex patterns to match agains cgi.http_host. This is default detection. If you want your own detection, then just create a method called : detectEnvironment() that returns a string (the environment key). Then, we call a method on your config cfc that matches the name of your environment, ex: development(). So you can override or do what you want in that environment. All in one cfc.

environments = {
dev = “localhost,^cf8.*”
};

public void function dev(){
do your stuff here.
}

public string function detectEnvironment(){
do your own detection here.
}

Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Some feedback. By default, the "environment" value in
"controller.getSetting("Environment")" remains as "Production"
regardless of the environment you're in.

I was able to explicitly state the value by using the code below in my
development() method. However, if coldbox already knows the
environment it is in (as it's running the development() method) ,
maybe it should set this value for you.

settings = {
       // Environment
      environment = "development",
}

- Gabriel

This might be a missed thing by me. I will check it soon as it is
supposed to set it for you.

I’m just testing out the new ColdBox.cfc for config settings and so far pretty cool - nice work guys! Expect you have already got this on the “known issues” list, but the unit tests fail if you don’t have a ColdBox.xml.cfm (or uses it if you have both). I tracked it down to line 100 of BaseTestCase.cfc:

// Config.xml by convention if not set before setup() call.
if(NOT len(instance.configMapping) ){
instance.configMapping = appRootPath & “config/coldbox.xml.cfm”;
}

Really impressed by ColdBox 3 - thanks for your efforts :slight_smile:

  • John

Thanks John,

Next step is to tackle unit testing.

Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com