ColdBox 4 Issues installing in sub directory

Hi CB Group,

I am having an issue getting my new CB4 app installed in a sub directory. I keep getting component not found errors (e.g. invalid component definition, can’t find component [coldbox.system.web.Controller] ). The website root directory does not contain any .cfm/.cfc files and no application.cfc - but - it is the root directory in terms of Lucee / Tomcat / IIS. I am trying to install in a sub directory called “tools”. All of my app’s files, including application.cfc, are in the sub directory. I have been using CB for several years but never had to install in a sub directory. I want to install in the sub directory to avoid conflict with my client’s files in the root. It is a Lucee install and not a converted Railo. I built the application initially using box.exe (awesome BTW).

This is my application.cfc that is in the /tools directory. I have tried several things I have found online including updating “COLDBOX_APP_MAPPING” and adding a custom this.mapping for “/coldbox”. I also removed the “this.javaSettings” as some people suggested that the AdvancedScript and Simple example app templates were different (the only difference I found was the this.javaSettings). If I add mappings in Lucee directly for /coldbox to /coldbox/tools I then throw an error on “interceptors”. If I add a mapping for /interceptors to /interceptors/tools I get further but then my handlers/routes are off. I get an error stating the handler doesn’t exist because it’s looking at the sub directory as a handler. e.g. “/tools/xyz/abc”.

`
// Application properties
this.name = hash( getCurrentTemplatePath() );
this.sessionManagement = true;
this.sessionTimeout = createTimeSpan(0,0,30,0);
this.setClientCookies = true;

// COLDBOX STATIC PROPERTY, DO NOT CHANGE UNLESS THIS IS NOT THE ROOT OF YOUR COLDBOX APP
COLDBOX_APP_ROOT_PATH = getDirectoryFromPath( getCurrentTemplatePath() );
// The web server mapping to this application. Used for remote purposes or static purposes
COLDBOX_APP_MAPPING = “/tools”;
// COLDBOX PROPERTIES
COLDBOX_CONFIG_FILE = “”;
// COLDBOX APPLICATION KEY OVERRIDE
COLDBOX_APP_KEY = “”;

this.mappings["/coldbox"] = ‘C:\HostingSpaces\client\clientsite.com\wwwroot\tools\coldbox’;

// application start
public boolean function onApplicationStart(){
application.cbBootstrap = new coldbox.system.Bootstrap( COLDBOX_CONFIG_FILE, COLDBOX_APP_ROOT_PATH, COLDBOX_APP_KEY, COLDBOX_APP_MAPPING );
application.cbBootstrap.loadColdbox();
return true;
}
`

The only thing I can think of is to install on a sub domain and avoid the whole problem or try to force Lucee to look at the sub directory as it’s own context (if that possible but still not ideal for management reasons). I cannot install in the root because the clients files are all HTML.

Any help / advice would be appreciated.

Thank you,

Joe Rebis

Are you using inheritance on your application.cfc? There’s really no trick to making this work-- coldbox.system.bootstrap simply needs to resolve via a mapping or the standard component lookup order. Is ColdBox installed somewhere entirely outside your web root?

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,

Thanks for your reply. All files including the application.cfc are in the sub-directory which is under the web root. There is not an application.cfc in the root of the site- only in the sub-directory.Do I need an application.cfc in the root of the website? The ColdBox files are in the sub-directory called tools.

wwwoot
----Other HTML files
----Web-Inf etc
----Tools (coldbox & app files in this dir)

--------application.cfc
--------coldbox
------------system

Thanks,

Joe

I don’t see any issues there right off. Can you check to make sure the path for your /coldbox mapping is correct. I would recommend change it to a relative expandPath(). Also, check for a server level /coldbox mapping that might be pointing to an old version of ColdBox.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

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

He needs a mapping for ColdBox does he not.