Installing ColdBox to Apache Alias folder

I have installed ColdFusion 10 on Apache 2.2. If I create a ColdBox site at the DocumentRoot I have no issues. Alternatively, if I install ColdBox too the Directory C:/localhost-www/CFSite and reference it from a Virtual Host on a new port it works (e.g. http://localhost:8080/). But if I create an Alias (e.g. http://localhost/CFSite) for the same directory I get an error stating:

************* ERROR MSG *******************

Error building: coldbox.system.EventHandler -> Could not find the included template includes/helpers/ApplicationHelper.cfm. Note: If you wish to use an absolute template path (for example, template="/mypath/index.cfm") with include, you must create a mapping for the path using the ColdFusion Administrator. Or, you can use per-application settings to specify mappings specific to this application by specifying a mappings struct to THIS.mappings in Application.cfc.

Using relative paths (for example, template=“index.cfm” or template="…/index.cfm") does not require the creation of any special mappings. It is therefore recommended that you use relative paths with include whenever possible. with constructor arguments: {controller={[(Component=coldbox.system.web.Controller)]}}

I have not used Apache for quite some time, but I think the issue is on the Apache configuration.

http://localhost/CFSite is not working because you missed the port number 8080. It should be http://localhost:8080/CFSite. If you want to run the site like http://localhost/CFSite, then you should configure it to port 80. Is your server running IIS on port 80? If so, you need to disable it; and let the Apache use the port 80.

Thanks for the response. I have confirmed http://localhost/CFSite works with a “Hello World” index.cfm page but as soon as I drop ColdBox into the site I get ColdBox exceptions. The port of 8080 was to create a base URL on something other than the default port 80 to test with.

It seems as soon as I install ColdBox to a subfolder things start to fall apart.

http://localhost (works)
http://localhost:8080 (works)
http://localhost/CFSite (fails)
http://localhost/CFSite (fails)

Any other thoughts?

Thanks,
Jeff

Just a shot in the dark. Try to add/update /coldbox mapping to C:/localhost-www/CFSite/coldbox

Sorry, pretty green with all this. I’m not sure what you mean by add/update the mapping. Can you elaborate?

You’re going to need to provide a lot better details than that. Saying it “didn’t work” or “failed” doesn’t really give us much to go on. If you received an error, what was it? Is there a stack trace? Also, how are the files organized in your web site? When you say you put “coldbox” in a sub folder, do you mean the app or the framework folder as well? If you put the actual framework folder in the sub folder, you’ll need to create a CF mapping for /coldbox. This is just how ColdFusion works. Basically, the ColdBox app needs to be able to resolve the CFC path coldbox.system.Bootstrap

Thanks!

~Brad

ColdBox/CommandBox Developer Advocate
Ortus Solutions, Corp

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

Hi Brad,

Thanks for your thoughts. By failed or didn’t work I mean I received the error listed in the original question. It was a little vague but essentially, the first exception is the config.cfc, I think it’s that file, has a reference to the ApplicationHelper file of ‘includes/helpers/ApplicationHelper.cfm’ and complains because it cannot find it. As soon as I correct that, directly, it then complains it cannot find the LRU policy file. See the pattern of not finding file references?

The httpd.conf entries I mentioned has all this information about folder structure. Essentially I created the Coldbox files using CommandBox in the folder C:\localhost-www\CFSite. It’s this folder where I reference the solution both as a virtual directory (http://localhost:8080) and as a folder alias (http://localhost/CFSite). The Virtual Directory works since the site is at the root URL and the folder alias does not which produces the mentioned error since it’s in a subfolder. It appears to be a path issue.

You mentioned a mapping to /coldBox and I’m assuming you’re referring to the application.cfc at the root of the folder CFSite created by Coldbox. I found this article but couldn’t find the correct values that seemed to work. Do you have a suggestion?

The goal is this. The client has an existing site at, for example, http://mysite.mybiz.com with no design patterns like Coldbox or Semantic URL’s. They want a second CF site at http://mysite.mybiz.com/portal and a third RESTful api site at http://mysite.mybiz.com/api/v1/ where I’m trying to create these outside the existing folder structure for a number of maintenance reasons. I’m assuming this is all within the means of CF right?

Thanks a bunch,
Jeff

The LRU errors always happen when you have the actual coldbox.system folder in a directory but haven’t created a ColdFusion mapping for /coldbox that points to it. You’ll need to create a mapping in the CF administrator or in Application.cfc’s this.mappings that points to the coldbox folder.

As far as the application helper error, it’s because you have an incorrect path for your helper file. Your path probably starts with a leading slash, which means CF expands it to start in the web root. Since you’ve got your app in a subfolder, you need to use the appropriate path. I would recommend creating a CF mapping called something like /root in your Application.cfc that points to the root of the ColdBox app. Then you can make settings like the application helper something along the lines of “/root/includes/helpers/ApplicationHelper.cfc” which will resolve properly plus will remain portable regardless of the folder name that the app lives in

In regards to not being able to get your application specific mappings to work, I’d need to know what your folder structure is and what code you tried. I really think your 95% of the way there and just need to straighten out some of your settings that aren’t taking the sub folder into account.

Thanks!

~Brad

ColdBox/CommandBox Developer Advocate
Ortus Solutions, Corp

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

I now get a new error. I added this.mappings = { “/root” = “/localhost-www/CFSite” }, updated the COLDBOX_APP_MAPPING and COLDBOX_APP_ROOT_PATH in the Application.cfc file. I’m still missing something probably obvious, any thoughts?

My folder structure is as follows:

Apache Installation Path

C:\Apache22\

ColdFusion Installation Path

C:\ColdFusion\

ColdBox Application path

C:\localhost-www\CFSite\

Apache httpd.conf Alias (see attached httpd-cf-development.conf included by httpd.conf)

C:\localhost-www\CFSite\ => http://locahost/CFSite/

Coldbox.cfc (see attached)

applicationHelper = “/root/includes/helpers/ApplicationHelper.cfm”,

Application.cfc (see attached)

this.mappings = {
"/root" = "/localhost-www/CFSite"
};

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

Exceptions w/ StackTrace

Could not find the included template /coldbox/system/includes/BugReport.cfm.

Note: If you wish to use an absolute template path (for example, template="/mypath/index.cfm") with include, you must create a mapping for the path using the ColdFusion Administrator. Or, you can use per-application settings to specify mappings specific to this application by specifying a mappings struct to THIS.mappings in Application.cfc.
Using relative paths (for example, template=“index.cfm” or template="…/index.cfm") does not require the creation of any special mappings. It is therefore recommended that you use relative paths with include whenever possible.

The error occurred in C:/localhost-www/CFSite/coldbox/system/Bootstrap.cfc: line 514
Called from C:/localhost-www/CFSite/coldbox/system/Bootstrap.cfc: line 289
Called from C:/localhost-www/CFSite/coldbox/system/Bootstrap.cfc: line 353
Called from C:/localhost-www/CFSite/Application.cfc: line 41

512 : 			// Show Bug Report
513 : 			savecontent variable="local.exceptionReport"{
<b>514 : 				include "#bugReportTemplatePath#";
</b>515 : 			}
516 : 		} else {

httpd-cf-development.conf (335 Bytes)

httpd.conf (17.2 KB)

Coldbox.cfc (3.62 KB)

Application.cfc (1.81 KB)