I have read many posts by people who have problems with onSessionEnd.  This is 
my first conversion of application.cfm to application.cfc and the onSessionEnd 
is not working with the CFFunction I am trying to invoke.

I guess what's hanging this up is how to properly call the component from the 
/lib/components/ folder where it resides.

When a user logs in I am creating a session array that tracks a jobNumber and 
the last_completed_step in that job.  There are multiple jobs in a users 
session.  At the end of the session I want to write the updated array data back 
to the DB.

I should make it clear that at present I look into my log file and see that the 
session is started - as coded in the onSessionStart shown below.  Furthermore, 
the onSessionEnd also writes to the log file when I take out the invocation of 
the component.  In other words if I just tell it to write "Session ended." to 
the log file I will see it in the log file. I have set current session timeout 
in CF Administrator and my app.cfc for 3 minutes for testing.

If I call the "giveMeAnswer" method in the jobState.cfc from a separate file 
(also at the root level) the giveMeAnswer method works properly and returns the 
value "I am a CFC."

If I move the jobState.cfc to the root level and set the component attribute to 
"jobState" I am also getting a return from the component.

<!--- Runs when your session starts --->
<cffunction name="onSessionStart" returnType="void" output="false">

        <!--- :: invoke all session variables | moved out of on session start  
:: --->
        <cfinvoke 
component="#application.virtualPaths.cfcPath#system/sessionVars" method="init" 
/>

        <cflog file="#This.Name#" type="Information" text="Session started.">

</cffunction>

<!--- Runs when session times out --->

<cffunction name="onSessionEnd" returntype="void">
        <cfargument name="SessionScope" type="struct" required="true" />
        <cfargument name="ApplicationScope" type="struct" required="true" />
                        
        <cfinvoke component="/lib/components/jobState" method="giveMeAnswer" 
returnvariable="returnFromCfc">
        </cfinvoke>
                        
                        
        <cflog file="#This.Name#" type="Information" text="Session ended.  
#returnFromCfc#">

        <cfreturn />
</cffunction>

So, is it just not finding the component/method?  Any other ideas?

Thanks much, Jerry 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345334
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to