On init - Could not find the ColdFusion component or interface console./admin/config/Coldbox.

Running the latest code from master (yesterday).

My application is running under /console

All of my handlers, config and views are off the web root, in an application mapped folder. I’ve successfully done this in an app that is in the root, but no matter what I do, I can’t make it work for an app in a folder off root.

I have the following set up in Application.cfc:

this.mappings["/admin"] = expandPath("/…/mapped/admin");

//changed as there are subfolders currently, as we want this to always load with right path
COLDBOX_APP_ROOT_PATH = getDirectoryFromPath(getCurrentTemplatePath());

//The web server mapping to this application. Used for remote purposes or static purposes
COLDBOX_APP_MAPPING = “/console”;
//COLDBOX PROPERTIES
COLDBOX_CONFIG_FILE = “/admin/config/Coldbox.cfc”;

If I do this, I get:

# Could not find the ColdFusion component or interface console./admin/config/Coldbox.
Ensure that the name is correct and that the component or interface exists.

The error occurred in**/src/mapped/frameworks/coldbox/system/web/loader/CFCApplicationLoader.cfc: line 74**
Called from /src/mapped/frameworks/coldbox/system/web/services/LoaderService.cfc: line 52
Called from /src/mapped/frameworks/coldbox/system/Coldbox.cfc: line 71
Called from /src/admin/console/Application.cfc: line 61 |

If I try (from the documentation):
COLDBOX_CONFIG_FILE = “admin.config.Coldbox”;

I get:

# The Config File: /src/admin/console/admin.config.Coldbox can’t be found.

The error occurred in /src/mapped/frameworks/coldbox/system/core/util/Util.cfc: line 164
Called from /src/mapped/frameworks/coldbox/system/web/loader/XMLApplicationLoader.cfc: line 59
Called from /src/mapped/frameworks/coldbox/system/web/services/LoaderService.cfc: line 52
Called from /src/mapped/frameworks/coldbox/system/Coldbox.cfc: line 71
Called from /src/admin/console/Application.cfc: line 61
|


<br>162 : <cfargument name="detail" required="false" default=""><br>163 : <cfargument name="type" required="false" default="Framework"><br>**164 : <cfthrow type="#arguments.type#" message="#arguments.message#" detail="#arguments.detail#">**<br>165 : </cffunction><br>166 : <br>

|

My gut reaction is that this is a bug. If I specify a dot path, it should just assume I know what I’m doing, and leave it well enough alone.

That being said, if I’m setting things up badly can someone PLEASE tell me, 'cause I’m pulling my hair out here over this.

Mark

Just to complete the set - the documentation says:
COLDBOX_CONFIG_FILE - The absolute or relative path to the configuration XML or CFC file to load. This bypasses the conventions and uses the configuration file of your choice.

So I’m trying a absolute path -
COLDBOX_CONFIG_FILE = expandPath("/…/mapped/admin/config/Coldbox.cfc");

And I get the error.

Error Messages: Could not find the ColdFusion component or interface console./src/mapped/admin/config/Coldbox.

LINE: 74
Template: /src/mapped/frameworks/coldbox/system/web/loader/CFCApplicationLoader.cfc

The documentation claims I can use an applicaiton mapping, but really, I don’t think I can, if this COLDBOX_APP_MAPPING keeps hijacking everything.

That and somehow the file path doesn’t resolve to a dot notation either… so it’s all pretty fubar.

Really starting to lean towards this being a nasty bug.

Mark

You may want to test this yourself via your test rigs, but this is the change I made to CFCApplicationLoader, line 65 down.

Changed items in bold.

//Config Create Path
if( len(appMappingAsDots) ){
configCFCLocation = replaceNoCase(configCFCLocation, “/”, “.”, “all”);
if(configCFCLocation.startsWith(".")) //if it started with / it’s from root, so leave it the alone, or it will bite you.
{
configCreatePath = Right(configCFCLocation, Len(configCFCLocation) - 1);
}
else //this is a relative path, so append the appMapping
{
configCreatePath = appMappingAsDots & “.” & configCFCLocation;
}
}
else{
configCreatePath = configCFCLocation;
}

This ensures that the path from / is converted, when before it wasn’t, and then also does a check to say, if it was from root, then leave it alone, because it knows what it is doing better than the framework does.

Mark

Sorry Mark, on vacation here, but Ijust saw this, did the change make it work?

I can submit a ticket and get your fix or look into it?

Luis F. Majano
President
Ortus Solutions, Corp
www.ortussolutions.com

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

Social: twitter.com/lmajano facebook.com/lmajano

My fix did fix the issue, but in all honesty, I couldn’t work out where the '/'s where being changed into ‘.’, and I don’t think they were being changed at all.

I’m actually wondering (at 6am), that the fact is they weren’t - and it’s a by-product of the weird fact you can actually USE / in the path on *nix and \ on Windows in createObject(), and it’s just never been picked up before.

So the fix should really be something akin to:

//Config Create Path
configCFCLocation = replaceNoCase(configCFCLocation, “/”, “.”, “all”);
if( len(appMappingAsDots) ){
if(configCFCLocation.startsWith(".")) //if it started with / it’s from root, so leave it the alone, or it will bite you.
{
configCreatePath = Right(configCFCLocation, Len(configCFCLocation) - 1);
}
else //this is a relative path, so append the appMapping
{
configCreatePath = appMappingAsDots & “.” & configCFCLocation;
}
}
else{
if(configCFCLocation.startsWith(".")) //need to strip off preceding . if it exists.
{
configCreatePath = Right(configCFCLocation, Len(configCFCLocation) - 1);
}

configCreatePath = configCFCLocation;
}

But not sure if you had some sort of util to replace the / into . or not.

But yeah - this needs a bug ticket, did you want me to write one up and attach my proposed fix to it?

Mark

Thanks, added a ticket for this. Do you want to do a pull request?

Luis F. Majano
President
Ortus Solutions, Corp
www.ortussolutions.com

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

Social: twitter.com/lmajano facebook.com/lmajano

To be honest - I haven’t got a fork set up, I was just running this against the version of coldbox we have in our repo, so I can’t do a pull request at the moment).

Mark