Thanks Peter,
 
That's similar to what I've got in place already - and it works fine.  Would be 
good to understand what is occuring under the hood or whether this is a bug or 
not.
 
Jeff

        -----Original Message-----
        From: [email protected] [mailto:[EMAIL PROTECTED] 
On Behalf Of Peter Bell
        Sent: Tuesday, May 01, 2007 12:58 PM
        To: [email protected]
        Subject: [coldspring-dev] Application Scope out of sync?
        
        
        
        > It's interesting that onRequestStart is always run, but 
onApplicationStart isn't.  
        
        Of course, if this is the case a work around might be something along 
the lines of:
        
                <cfif NOT isDefined("application.whatever")>               
<cfset onApplicationStart()>        </cfif> in your onRequestStart() 
        
        Best Wishes,
        Peter
        
        
        On 5/1/07 10:41 AM, "Battershall, Jeff" <[EMAIL PROTECTED]> wrote:
        
        

                Chris, I see your point.  Yes, they are sharing the same 
Application.cfc but here's what I don't get - shouldn't ANY request (via 
Mach-ii or via rpc to my Remote facade) trigger onApplicationStart()? That's 
when/where I'm reloading my framework. 
                
                It would seem that somehow, a new request to the remote facade 
can occur without triggering onApplicationStart(). What I think SHOULD be 
happening is this:
                
                1) Flex app makes an rpc call to RemoteFacade.cfc
                2) Because RemoteFacade.cfc exists beneath Application.cfc, 
Application.cfc is automatically run.
                3) Because the application has timed out, onApplicationStart() 
is called.
                4) ColdSpring is loaded in the application scope.
                5) When RemoteFacade.cfc is finally run, 
application.serviceFactory is available.
                
                Unfortunately, this is NOT what happens and I don't know why.  
It would seem that an rpc call from Flex back to CF via AMF3 doesn't 
necessarily trigger onApplicationStart().  It should be noted that I"m doing 
CF/Flex integration via services-config.xml and named destinations that are 
being invoked with public not remote methods.  It's interesting that 
onRequestStart is always run, but onApplicationStart isn't.  
                
                At this point, I don't necessarily think this is a ColdSpring 
issue. The behavior could be a bug or by design.  It would be interesting to 
get someone from the CF enginerring team like Tom Jordahl to weigh in.  
                
                Jeff
                

                        
                         
                        -----Original Message-----
                        From:  [email protected]  
[mailto:[EMAIL PROTECTED] On Behalf Of Chris  Scott
                        Sent: Monday, April 30, 2007 6:45 PM
                        To:  [email protected]
                        Subject: [coldspring-dev]  Application Scope out of 
sync?
                        
                        OK, but, do the Mach-ii app  and the remote app share 
the same application scope? Same name in  Application.cfc/cfm? If so, what I 
believe is happening is, after your  application times out, your mach-ii app 
initializes the Application scope  without initializing your bean factory. So 
when your remote app hits it,  onApplicationStart is not called, and your bean 
factory is not initialized. 
                        
                         
                        C
                         
                        
                         
                         
                        Chris Scott
                         
                        [EMAIL PROTECTED]
                         
                         
                        http://cdscott.blogspot.com/
                         
                        http://www.coldspringframework.org/
                         
                        
                        
                         
                         
                        
                        
                         
                        
                        
                        
                         
                         
                        On Apr 30, 2007, at 9:27 AM, Battershall, Jeff wrote:
                        
                         
                        

                                
                                Chris,
                                
                                 
                                 
                                No  - I'm using Mach-ii but I'm not using the 
bean factory for that - everything  I'm doing is through a remote facade for a 
Flex front  end.
                                
                                 
                                 
                                Jeff
                                
                                

                                        
                                         
                                        -----Original Message-----
                                        From:  
[email protected] [mailto:[EMAIL PROTECTED]  On Behalf Of 
Chris Scott
                                        Sent: Monday, April 30, 2007  8:12 AM
                                        To: 
[email protected]
                                        Subject:  [coldspring-dev] Application 
Scope out of sync?
                                        
                                        Jeff,  are you also using model-glue to 
access the same bean factory?  
                                        
                                         
                                        Chris
                                         
                                        
                                         
                                         
                                        Chris Scott
                                         
                                        [EMAIL PROTECTED]
                                         
                                         
                                        http://cdscott.blogspot.com/
                                         
                                        http://www.coldspringframework.org/
                                         
                                        
                                        
                                         
                                        <TeamFusionD.gif>
                                        
                                         
                                        
                                        
                                         
                                        
                                        
                                        
                                         
                                         
                                        On Apr 26, 2007, at 9:02 AM, 
Battershall, Jeff wrote:
                                        
                                         
                                        

                                        
                                        What I ended up doing, which is 
strictly in the workaround  category, is check for the existence of my 
serviceFactory in  onRequestStart, and re-loading it if not.  That "works" but 
I wish  I knew what was really going on.
                                        
                                         
                                         
                                        Jeff
                                        
                                         
                                         
                                         
                                        -----Original Message-----
                                        From:  
[email protected]  [mailto:[EMAIL PROTECTED]  On Behalf Of 
Battershall, Jeff
                                        Sent: Wednesday, April  25, 2007 9:02 AM
                                        To: 
[email protected]
                                        Subject:  [coldspring-dev] Application 
Scope out of  sync?
                                        
                                        
                                        

                                        
                                        Thanks Chris. The swf is embedded in a 
.cfm page,  though.  I would think that onApplicationstart() would be  run when 
I'm hitting my remote facade which lives beneath the  Application.cfc (of 
course).
                                        
                                         
                                         
                                        I'll try destroying the services.  I 
could also check for  the existence of the services in the application scope on 
each  request, but I've heard that there are some security issues with  flash 
remoting and the onRequestStart()  function.
                                        
                                         
                                         
                                        Jeff
                                        
                                        

                                        
                                         
                                        -----Original Message-----
                                        From: 
[email protected]  [mailto:[EMAIL PROTECTED]  On Behalf Of 
Chris Scott
                                        Sent: Tuesday, April 24,  2007 8:35 PM
                                        To: 
[email protected]
                                        Subject:  [coldspring-dev] Application 
Scope out of  sync?
                                        
                                        What is probably happening here is your 
 swf is embedded in an html file. When it accesses the remote facade,  the 
application has timed out. You could change your index.html file  to be 
index.cfm, which would restart the application, or but a ping  service in your 
main.mxml file that just hits a cfm page on  creationComplete, which will have 
the same effect. I would also  suggest you have your services destroyed 
onApplicationEnd in  application.cfc  
                                        
                                         
                                        Chris
                                         
                                        
                                         
                                         
                                        Chris Scott
                                         
                                        [EMAIL PROTECTED]
                                         
                                         
                                        http://cdscott.blogspot.com/
                                         
                                        http://www.coldspringframework.org/
                                         
                                        
                                        
                                         
                                        <TeamFusionD.gif>
                                        
                                         
                                        
                                        
                                         
                                        
                                        
                                        
                                         
                                         
                                        On Apr 24, 2007, at 1:20 PM, 
Battershall, Jeff wrote:
                                        
                                         
                                        

        
        I've run into a phenomena I have no  explanation for, and I'm looking 
for advice.  Here's the  scenario:
         
        
         
        I've added a function loadFramework() to  my Application.cfc that is 
run during onApplicationStart().
         
        
         
        Then I've got a remote façade that is  being used to provide services 
to a Flex 2 app, using CFMX 7.02 as  the backend.
         
        
         
        Periodically, I'm getting an error :  Element SERVICEFACTORY is 
undefined in a Java object of type class  [Ljava.lang.String; referenced as ". 
Note: SERVICEFACTORY is  residing in the application scope.
         
        
         
        This error disappears if I reload  ColdSpring.  I could  work around it 
by checking for it's existence in my Remote façade  and loading it, but that is 
a kludge. What I don't understand is  how my SERVICEFACTORY could not exist in 
the application scope if  onApplicationStart() is reloading my framework.
         
        
         
        Note my call to loadFramework() isn't  CFLOCKed although the code in 
the function is - perhaps it should  be? To prevent a race condition?
         
        
         
        Anyone encountered this or something  similar?
         
        
         
        Jeff Battershall
         
        Application Architect
         
        Dow Jones Indexes
         
        [EMAIL PROTECTED]
         
        (609) 520-5637 (p)
         
        (484) 477-9900 (c)
         
        
        

                                        
                                        

                                        
                                        

                        
                        

                
                

        
        

<<image.gif>>

Reply via email to