I am new to ColdBox and this community and could really use some help figuring out an issue with using Coldbox with our legacy app. I recently installed Coldbox 5.3.1 onto Coldfusion 2018. I am randomly getting an error while trying to use the DI aspects of WireBox. Most of the time it works as intended but periodically, perhaps every 5-6 hours, I get a dependency injection error message. I never get this error on pages that use the Coldbox HMVC framework, just the legacy .CFM pages that are trying to access the Coldbox models.
I went through an old Into the Box talk to help me modify my Application.cfc to get Coldbox to work with the legacy app but I am pretty certain there is something I missed along the way. Reinitting Coldbox seems to temporarily fix the error but I really need to get to the root cause of the issue.
I attached the error message below along with some code blocks. Any help would be much appreciated. Thanks
Message Content:
The target 'models.JobsPlus' requested a missing dependency with a Name of 'JobsPlusAwardDates' and DSL of 'model' {"javaCast":null,"ref":null,"scope":"variables","required":true,"value":null,"dsl":"model","type":"any","argName":"","name":"JobsPlusAwardDates"}
The error occurred on line 561.
C:\ColdFusion2018\cfusion\wwwroot\coldbox\system\ioc\Builder.cfc, Line 561
C:\ColdFusion2018\cfusion\wwwroot\coldbox\system\ioc\Injector.cfc, Line 943
C:\ColdFusion2018\cfusion\wwwroot\coldbox\system\ioc\Injector.cfc, Line 699
C:\ColdFusion2018\cfusion\wwwroot\coldbox\system\ioc\scopes\NoScope.cfc, Line 49
C:\ColdFusion2018\cfusion\wwwroot\coldbox\system\ioc\Injector.cfc, Line 417
Application.cfc:
component extends='coldbox.system.Bootstrap' {
// Application properties
this.name = "HousingWebApp";
this.applicationTimeout = "#createTimespan(2,0,0,0)#";
this.sessionManagement = "true";
this.sessionTimeout = "#createTimeSpan(2,0,0,0)#";
this.setClientCookies = "true";
COLDBOX_APP_ROOT_PATH=expandPath( '/' );
COLDBOX_APP_MAPPING='/';
COLDBOX_CONFIG_FILE = ""; // COLDBOX PROPERTIES
COLDBOX_APP_KEY = ""; // COLDBOX APPLICATION KEY OVERRIDE
// 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();
// Create wirebox injector for legacy code
wirebox = new coldbox.system.ioc.Injector();
return true;
}
// request start
public boolean function onRequestStart(String targetPage){
// Verify ColdBox is loaded
reloadChecks();
// Determine if the URL path is destined for ColdBox.
if(
// Coldbox is processing these files
( arguments.targetPage == '/index.cfm' && len( cgi.path_info) )
)
{
processColdBoxRequest();
// Returning false prevents the legacy code from also kicking in
return false;
}
// Else proceed to legacy code
application.cbController.getModuleService().loadMappings();
application.cbController.getInterceptorService().processState("preProcess");
return true;
}
}
view.cfm:
<cfset objJobsPlus = application.wirebox.getInstance("models.JobsPlus")>
models.JobsPlus.cfc:
component accessors="true" {
// Properties
property name="JobsPlusAwardDates" inject;
...