I'm currently facing an issue with my ColdFusion application where I'm encountering the error message: "Error invoking CFC for gateway file: null." This error was logged inside the eventgateway.log.
Here's what I've done so far:
<cfcomponent output="false">
<cffunction name="onIncomingMessage" output="false" returnType="void">
<cfargument name="cfEvent" type="struct" required="yes">
<cflog file="test" text="Here!">
<cftry>
<cfscript>
if(not structKeyExists(arguments.cfEvent.data, "file"))
arguments.cfEvent.Data.file="defaultEventLog";
if(not structKeyExists(arguments.cfEvent.data, "type"))
arguments.cfEvent.Data.type="info";
</cfscript>
<cflog file="application" text="Your log message here">
<!--- If an error occurs, the control will jump to the cfcatch block --->
<cfcatch type="any">
<!--- Handle the error --->
<cflog file="application" text="An error occurred: #cfcatch.message#">
<cfoutput>
An error occurred: #cfcatch.message#
</cfoutput>
</cfcatch>
</cftry>
</cffunction>
</cfcomponent>
And this is the code trying to invoke the event gateway.
<cftry>
<cfscript>
status = false;
cfEvent = structNew();
cfEvent.message = "Replace me with a variable with data to log";
status = SendGatewayMessage("file", cfEvent);
if (status IS true) WriteOutput('Event Message "#cfEvent.Message#" has been sent.');
</cfscript>
<!--- If an error occurs, the control will jump to the cfcatch block --->
<cfcatch type="any">
<!--- Handle the error --->
<cflog file="application" text="An error occurred: #cfcatch.message#">
<cfoutput>
An error occurred: #cfcatch.message#
</cfoutput>
</cfcatch>
</cftry>
I've checked my code and configurations, but I'm still unable to pinpoint the exact cause of this error. Could anyone help me please?