Copy link to clipboard
Copied
I have a component that declares a closure, executing the closure fails when run outside of the original request. It's calling another component function but getting this error
java.lang.IllegalArgumentException: Response cannot be null
Any solution will be helpful.
Copy link to clipboard
Copied
Post some code, maybe?
Dave Watts, Eidolon LLC
Copy link to clipboard
Copied
I am facing the same type of error during AzureServiceBus onSuccess thread:
To do this, I have registered a message handler first:
azureServiceBusConnectionString = application.wirebox.getInstance( 'clientService' ).getAzureQueueConnectionString();
azureServiceBus = getCloudService(
{
"vendorName" : "AZURE",
"connectionString" : azureServiceBusConnectionString
},
{
"serviceName" : "SERVICE_BUS"
}
);
myQueue = azureServiceBus.getQueue( "queuecreatefortest3" );
myQueue.registerMessageHandler({
"autocomplete": "yes",
"maxautorenewduration": "50M",
"onSuccess": function( struct message ) {
writeLog( text = "From onSuccess: " & serializeJSON( arguments ), type = "Information", file = "sushovan" );
cfhttp( url="http://localhost/dev250/azureServiceBusQueueProxy.cfm" );
writeLog( text = "From onSuccess: " & serializeJSON( cfhttp ), type = "Information", file = "sushovan" );
},
"onError": function() {
writeLog( text = "From onError: " & serializeJSON( arguments ), type = "Information", file = "sushovan_error" );
}
});
Then to queue message, I have used this following code:
azureServiceBusConnectionString = application.wirebox.getInstance( 'clientService' ).getAzureQueueConnectionString();
azureServiceBus = getCloudService(
{
"vendorName" : "AZURE",
"connectionString" : azureServiceBusConnectionString
},
{
"serviceName" : "SERVICE_BUS"
}
);
myQueue = azureServiceBus.getQueue( "queuecreatefortest3" );
getMessageResponse = myQueue.sendMessage({
"messageBody": {
"orderId": 434522,
"order_id": 434522,
"data": '{"dev_number":"250","order_id":434522,"amount":"0.01","prev_process_id":430022277,"transaction_tag":"430022277","txntype_id":2,"override":false,"mid_id":0}',
"DEV_NUMBER": "250",
"BATCH_ID": "",
"processId": 430022277
}
});
When a queue message comes, it triggers `onSuccess`, here I can see first writeLog is working, next `cfhttp` is not working and giving the following error:
==> /Applications/ColdFusion2021/cfusion/logs/exception.log <==
"Error","pool-47-thread-3","10/10/23","18:49:58","dev250_front","Response cannot be null"
java.lang.IllegalArgumentException: Response cannot be null
at coldfusion.jsp.ServletResponseWrapper.<init>(ServletResponseWrapper.java:18)
at coldfusion.jsp.HttpServletResponseWrapper.<init>(HttpServletResponseWrapper.java:15)
at coldfusion.jsp.JspWriterIncludeResponse.<init>(JspWriterIncludeResponse.java:20)
at coldfusion.runtime.NeoPageContext.pushBody(NeoPageContext.java:2471)
at coldfusion.runtime.NeoPageContext.pushBody(NeoPageContext.java:2446)
at coldfusion.runtime.CfJspPage._pushBody(CfJspPage.java:3170)
at cfsushovan2ecfm393242937$func_CF_ANONYMOUSCLOSURE_0.runFunction(/Users/sushovan/Projects/wwwroot/repository/wwwroot/sushovan.cfm:17)
at coldfusion.runtime.Closure.invoke(Closure.java:171)
at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:516)
at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:95)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:463)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:260)
at coldfusion.runtime.async.CallableUDFMethod.call(CallableUDFMethod.java:175)
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)