[Coldbox 6.5.2] Coldbox Schedule Tasks: Injector not found in scope registration information

I am continuing my exploration into the powerful Coldbox Scheduled Tasks feature. However, I’ve hit a snag when trying to run a scheduled task that calls a model object that has an injection DSL with provider: in it. This problem seems to only exist in Adobe engines.

I created the following issue here:

In case anyone wants to replicate the issue, or point out a mistake I made, here are the steps to reproduce:

  1. Create a new app and install a dependency like QB which needs to be loaded via the provider: injection DSL
coldbox create app
install qb
server set app.cfengine=adobe@2018 // Must use ACF
  1. Create a simple task module
    hint="I am a simple scheduled task"

    property name="qb" inject="provider:QueryBuilder@qb";
    function run() {

        // print that the task is running
        writeDump( var="Simple scheduled task is running", output="console" );

        var result = qb.select().from( "user" ).toSql();

        // print that the task finished
        writeDump( var=result, output="console" );
        writeDump( var="Simple scheduled task finished running", output="console" );


  1. Create a scheduled task:
component {
    function configure() {
        task( "SimpleTask" )
            .call( function() {
                writeDump( var="Running Simple Task", output="console" );
                wirebox.getInstance( "simpleTask" ).run();
                writeDump( var="Simple Task Complete", output="console" );
            } )
            .onFailure( function( task, exception ) {
                writeDump( var="Simple Task Failed!", output="console" );
                writeDump( var=exception, output="console" );
            } )
            .every( 15, "seconds" )

  1. Start your server and watch the console using server log --follow

You will see the immediate execution of the task will succeed. However, subsequent executions (every 15 seconds) will throw an exception:

Detail: Scope information: {SCOPE={application},ENABLED={true},KEY={wireBox}}
ErrorCode: [empty string]
ExtendedInfo: [empty string]
Message: Injector not found in scope registration information
StackTrace: coldfusion.runtime.CustomException: Injector not found in scope registration information

The error message is slightly different if the scheduled task executes from a submodule, but I believe the issue is the same.

As I commented on your ticket, did you test this on the bleeding edge? We just put in fixes a couple weeks ago for accessing the application scope in Adobe CF inside scheduler threads.

Thanks, Brad. :slight_smile: Yes, I tested it on BE and the sample task runs as expected in ACF. I also tested the same task running in a module and everything worked there as well. The only stat that still doesn’t get populated is nextRun for some reason, but otherwise, everything looks good!

1 Like