[ColdBox 3.7.0] Error: The DSLNamespace: coldbox cannot be used as it requires a ColdBox Context

I am working on a legacy application on which we have recently introduced ColdBox. In the onApplicationStart of onapplication.cfc we have the following code:

application.cbBootstrap = CreateObject("component","coldbox.system.Coldbox").init(this.cbSettings.COLDBOX_CONFIG_FILE, this.cbSettings.COLDBOX_APP_ROOT_PATH, this.cbSettings.COLDBOX_APP_KEY, this.cbSettings.COLDBOX_APP_MAPPING); application.cbBootstrap.loadColdbox(); application.wbInjector = createObject("component","coldbox.system.ioc.Injector").init("intranet.sqbox.config.WireBox");

The last line of which creates a global injector that is used in our legacy code to get access to objects managed by the IOC container. Everything has been working great until I attempted to inject the ORMService plugin into a repository component:

property name="ORMService" inject="coldbox:plugin:ORMService";

The component that contains this is injected into other components where necessary. For the most part this works fine, except for cases where the wbInjector from above is utilized in legacy code to get access to an object that has the repository in question injected into it. That code looks like this:

<cfset searchService = application.wbInjector.getInstance("RailoSearchService")>

The RailoSearchService gets the repository in question injected into its constructor. In this case I get the error in the subject of this post.

Any ideas what I am doing wrong?

Thanks.

Since it is a secondary manually created injector it has no linkage to the ColdBox context. That dependency you requested needs it to build orm service objects. Either set ColdBox into the injector or don’t use that dependency

Thanks Luis. How do I go about setting coldbox into the injector?

Thanks,

Ryan

I tried updating the injector line in application.cfc to:

application.wbInjector = createObject("component","coldbox.system.ioc.Injector").init(binder="intranet.sqbox.config.WireBox", coldbox=application.cbBootstrap);

But now I get the following error:

`
Oops! An error has occurred
Please provide the following information to technical support:

Error: component [coldbox.system.Coldbox] has no function with name [getLogBox]

Template: C:\inetpub\wwwroot\Version130Dev\coldbox\system\ioc\Injector.cfc

Detail:

Error on line: 113 in C:\inetpub\wwwroot\Version130Dev\coldbox\system\ioc\Injector.cfc
Error on line: 92 in C:\inetpub\wwwroot\Version130Dev\coldbox\system\ioc\Injector.cfc
Error on line: 89 in C:\inetpub\wwwroot\Version130Dev\Intranet\Application.cfc

Type: expression

`