i see nothing in the CF community about this and since many here have CF for
their back-end apps I figured I'd give it a try.

I'm using CF7 standard on the backend and communicating to my CFC's with
remote object.  The problem I've had for months now is every now and then
the onApplicationStart and onSessionStart methods stop firing in my
Application.cfc when a Flex request comes in.  It actually appears to ignore
the Application.cfc altogether.  The reason I suspect this is because none
of my application or session variables exist in my CFC's when this problem
happens, aren't those functions supposed to fire automatically? What would
cause them not to?

A restart of the server might fix it, might not- i never know until i tinker
with the CFC's and application.cfc file settings until it magically starts
working again.  Then a few days later, it's back again.  The relevant parts
of my application.cfc are pasted below- has anyone ever seen behavior like
this???

<cfcomponent
    displayname="Application"
    output="true"
    hint="Handle the application.">

    <cfscript>
       this.name = "MyApp";
       this.applicationTimeout = createTimeSpan(1,0,0,0);
       this.sessionmanagement = "yes";
       this.sessiontimeout = createTimeSpan(0,1,0,0);
       this.scriptProtect = "all";
   </cfscript>

    <cffunction
        name="OnApplicationStart"
        access="public"
        returntype="boolean"
        output="false"
        hint="Fires when the application is first created.">

        <cfscript>
         application.portalDSN = "portal";
         application.sessions = 0;
       </cfscript>

        <cflog file="#this.name#" type="Information" text="Application #
this.name# Started">

        <cfreturn true />
    </cffunction>

    <cffunction name="onSessionStart" output="false">
        <cfscript>
           session.started = now();
           session.projectID = 0;
           if(cgi.SERVER_NAME CONTAINS "local")
           {
               session.clientDSN = "clientBase";
           }
           else
           {
               session.clientDSN = ListFirst(cgi.SERVER_NAME,".");
           }
        </cfscript>

        <cfquery datasource="#application.portalDSN#" name="qGetClientID">
        SELECT clientID FROM clients WHERE folderName = <cfqueryparam
cfsqltype="cf_sql_varchar" value="#session.clientDSN#">
        </cfquery>
        <cfset session.clientID = qGetClientID.clientID>

        <cflock scope="application" timeout="5" type="Exclusive">
           <cfset application.sessions = application.sessions + 1>
        </cflock>
   </cffunction>

Reply via email to