Running Fusebox No XML with a virtual directory

March 30, 2008

There has been a post on the fusebox forums about a error that occurs when trying to run the XML free implimentation of Fusebox 5.5 from a virtual directory in IIS.

The error they are getting is:

Could not find the ColdFusion Component or Interface noxml.controller.app. Ensure that the name is correct and that the component or interface exists.  The error occurred in E:\papps\fl\laf_dev\skeleton\noxml\parsed\app.welcome.cfm: line 9 Called from E:\apps\fusebox5\Application.cfc: line 228 Called from E:\apps\fusebox5\Application.cfc: line 218 
7 : <cfset myFusebox.thisCircuit = "app">
8 : <cfset myFusebox.thisFuseaction = "welcome">
9 : <cfparam name="__fuseboxCircuitCfc_noxml_controller_app" default="#createObject('component','noxml.controller.app')#" />
10 : <cfif structKeyExists(__fuseboxCircuitCfc_noxml_controller_app,"prefuseaction") and isCustomFunction(__fuseboxCircuitCfc_noxml_controller_app.prefuseaction)>
11 : <cfset __fuseboxCircuitCfc_noxml_controller_app.prefuseaction(myFusebox=myFusebox,event=event) />

After several unsuccessful suggestions I decided to recreate the problem and this is how I solved it.

  1. Add the Fusebox core files directory at the same level as your index.cfm
  2. Create a new Application.cfm, delete (or rename) Application.cfc
  3. To make the noxml example work, create fusebox.init.cfm

Now add the following code....

Application.cfm

<cfsilent>
<!---
sample Application.cfm for ColdFusion MX 6.1 and other compatible systems that do not support Application.cfc
trapping non-index.cfm requests is not necessary with Application.cfc if you extend fusebox5.Application:
--->
<cfif right(cgi.script_name, len("index.cfm")) neq "index.cfm" and right(cgi.script_name, 3) neq "cfc">
<cflocation url="index.cfm" addtoken="no" />
</cfif>
<!--- there must be no newline after the closing cfsilent tag if you want all leading whitespace suppressed --->

<!--- set application name based on the directory path --->
<cfapplication name="#Right(ReReplace(UCase(GetDirectoryFromPath(GetCurrentTemplatePath())), "[^A-Z0-9]", "", "all"), 64)#" />

<cfscript>

// must enable implicit (no-XML) mode!
FUSEBOX_PARAMETERS.allowImplicitFusebox = true;

// the rest is taken straight from the traditional fusebox.xml skeleton:
FUSEBOX_PARAMETERS.defaultFuseaction = "app.welcome";
// you may want to change this to development-full-load mode:
FUSEBOX_PARAMETERS.mode = "development-circuit-load";
FUSEBOX_PARAMETERS.conditionalParse = true;
// change this to something more secure:
FUSEBOX_PARAMETERS.password = "skeleton";
FUSEBOX_PARAMETERS.strictMode = true;
FUSEBOX_PARAMETERS.debug = true;
// we use the core file error templates:
FUSEBOX_PARAMETERS.errortemplatesPath = "fusebox5/errortemplates/";

// These are all default values that can be overridden:
// FUSEBOX_PARAMETERS.fuseactionVariable = "fuseaction";
// FUSEBOX_PARAMETERS.precedenceFormOrUrl = "form";
// FUSEBOX_PARAMETERS.scriptFileDelimiter = "cfm";
// FUSEBOX_PARAMETERS.maskedFileDelimiters = "htm,cfm,cfml,php,php4,asp,aspx";
// FUSEBOX_PARAMETERS.characterEncoding = "utf-8";
// FUSEBOX_PARAMETERS.strictMode = false;
// FUSEBOX_PARAMETERS.allowImplicitCircuits = false;

// force the directory in which we start to ensure CFC initialization works:
FUSEBOX_CALLER_PATH = getDirectoryFromPath(getCurrentTemplatePath());
</cfscript>

</cfsilent>

index.cfm

<cfinclude template="fusebox5/fusebox5.cfm" />

fusebox.init.cfm

<cfset myFusebox.getApplicationData().startTime = Now() />

It is worth noting that traditionally you would use the fusebox.appinit.cfm file and not fusebox.init.cfm to set application variables, but the noxml version of Fusebox doesn't seem to include this file.

You can read the original thread in the fusebox forums.


No comments

Leave a comment

If you found this post useful, interesting or just plain wrong, let me know - I like feedback :)

Please note: If you haven't commented before, then your comments will be moderated before they are displayed.