user1002794
user1002794

Reputation: 163

Coldfusion - runAsnyc method not allowing the instantiation of Beans

My basic example errors with a null point exception error. This error only manifests when we instantiate the basic bean. Is there some sort of restriction on instantiating beans in Async?

Coldfusion 2018 - V 2018.0.08.330106

Bean code

<cfcomponent displayname="TestBean" hint="I model a single TestBean." output="false">

    <!--- CONSTRUCTOR --->
    <cffunction name="init" access="public" output="false" returntype="TestBean">
        <cfscript>
            return(this);
        </cfscript>
    </cffunction>
   
</cfcomponent>

test cfm code

    <cfscript>
        arErrors= [];
    
        initiatedAsyncProcesses = [];
        initiatedAsyncProcesses.append(runAsync(function() {
            local.TestBean = new TestBean(); 
    
        }).error(
            function(error){arrayAppend(arErrors, error)}
            ));
    
        //Wait for errors
        sleep(100);
        writedump(arErrors);
    
    </cfscript>

Complete

Error produced

==> /opt/coldfusion2018/cfusion/logs/exception.log <==
"Error","pool-10-thread-12","10/03/23","10:21:07","","java.lang.NullPointerException"
java.util.concurrent.ExecutionException: java.lang.NullPointerException
        at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
        at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
        at coldfusion.runtime.async.Future.get(Future.java:146)
        at coldfusion.runtime.async.CallableUDFMethod.call(CallableUDFMethod.java:90)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.NullPointerException

Upvotes: 1

Views: 64

Answers (0)

Related Questions