WIrebox error in pluginService.cfc

Hi Guys,

CB 3.5 Beta.

When I fwreinit my application I get an error and after some investigation I found it happens when trying to use the clientStorage plugin.

The application used to work when I was using the CB 3.5 dev branch.

Anyone have any idea what is going on?
The ‘new’ function in PluginService does not seem to be setting the wirebox variable.

var oPlugin = 0; var pluginLocation = ""; var pluginLocationKey = arguments.plugin & arguments.custom & arguments.module; var attribs = "";

// Locate Plugin, lazy loaded and cached
if( NOT structKeyExists(instance.refLocationMap, pluginLocationKey) ){
instance.refLocationMap[pluginLocationKey] = locatePluginPath(argumentCollection=arguments);
}
pluginLocation = instance.refLocationMap[pluginLocationKey];

// Check if plugin mapped?
if( NOT wirebox.getBinder().mappingExists( pluginLocation ) ){
attribs = {
pluginPath = pluginLocation,
custom = arguments.custom,
module = arguments.module,
isPlugin = true
};
// feed this plugin to wirebox with virtual inheritance just in case, use registerNewInstance so its thread safe
wirebox.registerNewInstance(name=pluginLocation,instancePath=pluginLocation)
.virtualInheritance(“coldbox.system.Plugin”).initWith(controller=controller).extraAttributes( attribs );
}
// retrieve, build and wire from wirebox
oPlugin = wirebox.getInstance( pluginLocation );

//Return plugin
return oPlugin;

The web site you are accessing has experienced an unexpected error.
Please contact the website administrator.

The following information is meant for the website developer for debugging purposes.

Error Occurred While Processing Request

Variable WIREBOX is undefined.

The error occurred in E:\www\development\coldbox\system\web\services\PluginService.cfc: line 128
Called from E:\www\development\coldbox\system\web\services\PluginService.cfc: line 160
Called from E:\www\development\coldbox\system\web\Controller.cfc: line 325
Called from E:\www\development\coldbox\system\ioc\dsl\ColdBoxDSL.cfc: line 188
Called from E:\www\development\coldbox\system\ioc\dsl\ColdBoxDSL.cfc: line 42
Called from E:\www\development\coldbox\system\ioc\Builder.cfc: line 320
Called from E:\www\development\coldbox\system\ioc\Injector.cfc: line 575
Called from E:\www\development\coldbox\system\ioc\Injector.cfc: line 462
Called from E:\www\development\coldbox\system\ioc\scopes\Singleton.cfc: line 48
Called from E:\www\development\coldbox\system\ioc\Injector.cfc: line 262
Called from E:\www\development\coldbox\system\ioc\Builder.cfc: line 437
Called from E:\www\development\coldbox\system\ioc\Builder.cfc: line 343
Called from E:\www\development\coldbox\system\ioc\Injector.cfc: line 575
Called from E:\www\development\coldbox\system\ioc\Injector.cfc: line 462
Called from E:\www\development\coldbox\system\ioc\scopes\NoScope.cfc: line 33
Called from E:\www\development\coldbox\system\ioc\Injector.cfc: line 262
Called from E:\www\development\coldbox\system\ioc\config\Binder.cfc: line 826
Called from E:\www\development\coldbox\system\ioc\Injector.cfc: line 159
Called from E:\www\development\coldbox\system\ioc\Injector.cfc: line 92
Called from E:\www\development\coldbox\system\web\services\LoaderService.cfc: line 144
Called from E:\www\development\coldbox\system\web\services\LoaderService.cfc: line 73
Called from E:\www\development\coldbox\system\Coldbox.cfc: line 71
Called from E:\www\development\AvisFuelCard\Application.cfc: line 60

126 : 			pluginLocation = instance.refLocationMap[pluginLocationKey];
127 : 			
**128 : 			writedump(var=wirebox);**
129 : 			abort;
130 : 			

Hi Guys,

I made a little bit of progress as I can avoid the error, but it is starting to look like a CB bug… Let me elaborate:

When I create a mapping in my WireBox.cfc like this:

map(“CardHolder@root”)
.to(“model.CardHolder”);
map(“Bearer@beans”)
.to(“model.beans.Bearer”);
map(“Voucher@beans”)
.to(“model.beans.Voucher”);

Everything works fine, but as soon as I add an eagerInit:

map(“CardHolder@root”)
.to(“model.CardHolder”)
.asEagerInit();
map(“Bearer@beans”)
.to(“model.beans.Bearer”);
map(“Voucher@beans”)
.to(“model.beans.Voucher”);

And boom, the error I showed earlier is thrown again… Is it a coldbox/wirebox bug?

The same happens when I create an application from scratch using the advanced template with some dummy mappings to dummy model objects.

Does the eagerly initialized object need a plugin, an interceptor or something coldbox related?

Luis F. Majano
CEO
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

Hi Luis,

The only thing I can think of from the top of my head is the ClientStorage plugin and when I do a dump just before the error is thrown it is indeed busy loading the ClientStorage plugin.

I may have some strange construct that could be the cause of it:

My CardHolder@root has a property: property name=“cardHolderService” inject=“CardHolderService@services”;

And my CardHolderService@services has a property: property name=“wirebox” inject=“Wirebox”;

This is so I can use in my function calls:
var bearer = wirebox.getInstance(name=“Bearer@beans”); (because ‘new’ is ‘evil’) :smiley:

Maybe that is where things go wrong.

I will do some more tests today when I have the chance and will let you know my findings.

Cheers,
Tom