ColdBoxProxy - ColdBox Controller Not Found

I'm trying to use ColdBoxProxy to dispatch an event...

Code to dispatch the event:
4: <cfset coldboxproxy = createObject
("component","folder.coldBox.coldboxproxy")>
5: <cfset arguments["event"] = "ehGeneral.process">
6: <cfset results = coldboxproxy.process(argumentCollection=arguments)

Error message generated:
Error Occurred While Processing Request
ColdBox Controller Not Found
The coldbox main controller has not been initialized

The error occurred in D:\Inetpub\Wwwroot\coldbox\system\util\Util.cfc:
line 25
Called from D:\Inetpub\Wwwroot\coldbox\system\extras\ColdboxProxy.cfc:
line 215
Called from D:\Inetpub\Wwwroot\coldbox\system\extras\ColdboxProxy.cfc:
line 225
Called from D:\Inetpub\Wwwroot\coldbox\system\extras\ColdboxProxy.cfc:
line 29
Called from D:\Inetpub\Wwwroot\folder\coldBox\coldboxproxy.cfc: line
17
Called from D:\Inetpub\Wwwroot\folder\testing\test.cfm: line 6

AppMapping is set. I've tried fwreinit.

Also tried loading ColdBox before calling the process method:
<cfset coldboxproxy.loadColdBox("../coldBox","../coldBox/config/
coldbox.xml.cfm")>

Error message generated:
The selected method getSetting was not found.

The error occurred in D:\Inetpub\Wwwroot\coldbox\system\extras
\ColdboxProxy.cfc: line 309
Called from D:\Inetpub\Wwwroot\folder\coldBox\coldboxproxy.cfc: line
26
Called from D:\Inetpub\Wwwroot\folder\testing\test.cfm: line 6

307 :
308 : <!--- Application Startup. --->
309 : <cfif cbController.getSetting("ApplicationStartHandler") neq
"" and (not cbController.getAppStartHandlerFired())>
310 : <cfset cbController.runEvent(cbController.getSetting
("ApplicationStartHandler"),true)>
311 : <cfset cbController.setAppStartHandlerFired(true)>

<cfdump var="#cbController#"> produces "[Empty string]"

So, any idea what I'm doing wrong here? Should the proxy even have to
call the loadColdBox method? Any input would be appreciated...

Hi,

The idea of the proxy, is that it must be located where your application resides so the application.cfc fires first. Basically, you are trying to simulate a remote call and will have to do more work because you are creating the proxy yourself and not coldfusion. The proxy is meant to be called remotely via remoting or web services because then the CF engine can execute the Application.cfc and make sure the application is up and running.

If you would like simulate this, you will have to do more work and several ways you can try.

  1. Create the Application.cfc object first and execute the method “reloadChecks()” so it can check for loads.
  2. Call your proxy and execute.

Second Approach,
Create the proxy object, load the coldbox application via loadColdbox, then execute a method on it. Just make sure that you have something in application scope which simulates the app.

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

I need to spend some more time on this, but so far:

I tried loading coldbox in "folder\application.cfm":

<cfif Not IsDefined("Application.coldbox")>
  <cfset Application.coldbox = createObject
("component","folder.coldbox.application")>
  <cfset Application.coldbox.reloadChecks()>
</cfif>

I've also tried in "folder\testing\test.cfm"

<cfset coldbox = createObject("component","folder.coldbox.application")

<cfset coldbox.reloadChecks()>
<cfset coldboxproxy = createObject
("component","folder.coldbox.coldboxproxy")>
<cfset arguments["event"] = "ehGeneral.process">
<cfset results = coldboxproxy.process(argumentCollection=arguments)>

Both result in:
"The setting RegisteredHandlers does not exist.
FWSetting flag is false
The error occurred in D:\Inetpub\Wwwroot\coldbox\system\util\Util.cfc:
line 25"

Great framework... Thanks for responding...

Steve,

Are you trying to do a remote call from another application or...?
Can you be more specific what you're trying to achieve.

You can avoid the cfc part by just doing an HTTP call using CFHTTP.
so... http://myserver.com/mycoldboxapp/coldboxproxy.cfc?method=process&event=ehGeneral.process
..or http://myserver.com/mycoldboxapp/?event=ehGeneral.process

Ernst

You are not configuring the application property so it cannot find the directories to load the handlers, etc.
You need to not only create the app but pass in the application mapping and configuration file locations (optional).

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