Re: anyway to initialize ORM AFTER onApplicationStart()?
On Thu, Mar 19, 2015 at 12:22 AM, Yuliang Ruan wrote: > > current app sets the datasource in onApplicationStart(). i can't have > ormEnabled=true unless there's a datasource.and it doesn't look like i > can intialize orm at the end of onApplicationStart() by doing a > this.ormEnabled=true > > what are the alternatives? > When we ran into this we moved datasource initialization from onApplicationStart() to onServerStart(). Jochem -- Jochem van Dieten http://jochem.vandieten.net/ ~| 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:360268 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
anyway to initialize ORM AFTER onApplicationStart()?
current app sets the datasource in onApplicationStart(). i can't have ormEnabled=true unless there's a datasource.and it doesn't look like i can intialize orm at the end of onApplicationStart() by doing a this.ormEnabled=true what are the alternatives? I'm thinking one where i set this.datasource at the top of Application.cfc using a method getDatasource() and pull all of the datasource configuration code that's currently in onApplicationStart() and putting it into that new method.but that's quite a bit of work and leads to lots of change and lots of testing. anything ideas for less changing? ~| 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:360265 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: onApplicationStart and cfmail, when doess server start?
yeah, i thought it would be some thing every one but me has done. a simple email to alert you that the server has started. we have diff monitering in place, but i cant touch it. thanks a bunch. -m On Tue, Apr 1, 2014 at 2:00 PM, Bobby wrote: > > The next thing that comes to mind is to parse the CF server.log file for > the instance you are targeting. There are log entries for stopping and > starting in there. ButŠI¹m guessing you are wanting this to be used as an > alert not post-portem investigation. > > There are plenty of infrastructure monitoring applications and 3rd party > services out there for monitoring your production servers (including the > services). My company uses PRTG for performance/service monitoring > (http://www.paessler.com/prtg) to cover all of our different servers. Im > mostly responsible for the health of our CF servers though and > FusionReactor works great for me. If you set it up correctly, it can > notify you of service availability changes. > > None of the above actual means that a server was ³rebooted² though and a > CF service stopping/starting also doesn¹t mean that someone manually > triggered it. > > Also, keep in mind that something running ON the server that is supposed > to send you this email is probably not going to work if its running on the > service you are trying to monitor. > > > > On 4/1/14, 12:11 PM, "morchella" wrote: > > > > >looks like onServerStart is turned off. i cant change that on our server. > > > > > > > >On Tue, Apr 1, 2014 at 11:49 AM, morchella > >wrote: > > > >> thanks guys! i was unfamilar with onServerStart. looking now! > >> Much appreciated! > >> > >> > >> > >> On Tue, Apr 1, 2014 at 11:44 AM, Bobby wrote: > >> > >>> > >>> The behavior you explained is expected. onApplicationStart() isnšt > >>> triggered until the first request to the application. > >>> > >>> Check out onServerStart and Server.cfc > >>> > >>> > >>> > >>> > http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WS7AC9408A-1AC6-4ab7- > >>>9C8 > >>> > >>>E-CF1DA8FCA16D.html< > http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/W > >>>S7AC9408A-1AC6-4ab7-9C8E-CF1DA8FCA16D.html> > >>> > >>> > >>> > >>> > >>> On 4/1/14, 11:31 AM, "morchella" > wrote: > >>> > >>> > > >>> >so i am trying some thing out on localhost befor i move to dev > >>> >i want to know when my cf server was started or restarted. > >>> >so after my onApplicationStart > >>> >i put in a cfmail and fir up an instance of cf9 for my localhost. > >>> > > >>> >i dont get the email unless i actually goto 127.x.x.x to view a page. > >>> >i thought i should get it imeditaly when the server starts? > >>> > > >>> >how would or should i be doing this. > >>> >thanks a bunch. > >>> >will help to know when offshore reboots some thing with out informing > >>>us. > >>> > > >>> >-m > >>> > > >>> > > >>> > > >>> > >>> > > > > > > ~| 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:358284 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: onApplicationStart and cfmail, when doess server start?
The next thing that comes to mind is to parse the CF server.log file for the instance you are targeting. There are log entries for stopping and starting in there. But I¹m guessing you are wanting this to be used as an alert not post-portem investigation. There are plenty of infrastructure monitoring applications and 3rd party services out there for monitoring your production servers (including the services). My company uses PRTG for performance/service monitoring (http://www.paessler.com/prtg) to cover all of our different servers. Im mostly responsible for the health of our CF servers though and FusionReactor works great for me. If you set it up correctly, it can notify you of service availability changes. None of the above actual means that a server was ³rebooted² though and a CF service stopping/starting also doesn¹t mean that someone manually triggered it. Also, keep in mind that something running ON the server that is supposed to send you this email is probably not going to work if its running on the service you are trying to monitor. On 4/1/14, 12:11 PM, "morchella" wrote: > >looks like onServerStart is turned off. i cant change that on our server. > > > >On Tue, Apr 1, 2014 at 11:49 AM, morchella >wrote: > >> thanks guys! i was unfamilar with onServerStart. looking now! >> Much appreciated! >> >> >> >> On Tue, Apr 1, 2014 at 11:44 AM, Bobby wrote: >> >>> >>> The behavior you explained is expected. onApplicationStart() isnšt >>> triggered until the first request to the application. >>> >>> Check out onServerStart and Server.cfc >>> >>> >>> >>>http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WS7AC9408A-1AC6-4ab7- >>>9C8 >>> >>>E-CF1DA8FCA16D.html<http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/W >>>S7AC9408A-1AC6-4ab7-9C8E-CF1DA8FCA16D.html> >>> >>> >>> >>> >>> On 4/1/14, 11:31 AM, "morchella" wrote: >>> >>> > >>> >so i am trying some thing out on localhost befor i move to dev >>> >i want to know when my cf server was started or restarted. >>> >so after my onApplicationStart >>> >i put in a cfmail and fir up an instance of cf9 for my localhost. >>> > >>> >i dont get the email unless i actually goto 127.x.x.x to view a page. >>> >i thought i should get it imeditaly when the server starts? >>> > >>> >how would or should i be doing this. >>> >thanks a bunch. >>> >will help to know when offshore reboots some thing with out informing >>>us. >>> > >>> >-m >>> > >>> > >>> > >>> >>> > > ~| 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:358277 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: onApplicationStart and cfmail, when doess server start?
looks like onServerStart is turned off. i cant change that on our server. On Tue, Apr 1, 2014 at 11:49 AM, morchella wrote: > thanks guys! i was unfamilar with onServerStart. looking now! > Much appreciated! > > > > On Tue, Apr 1, 2014 at 11:44 AM, Bobby wrote: > >> >> The behavior you explained is expected. onApplicationStart() isnšt >> triggered until the first request to the application. >> >> Check out onServerStart and Server.cfc >> >> >> http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WS7AC9408A-1AC6-4ab7-9C8 >> E-CF1DA8FCA16D.html<http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WS7AC9408A-1AC6-4ab7-9C8E-CF1DA8FCA16D.html> >> >> >> >> >> On 4/1/14, 11:31 AM, "morchella" wrote: >> >> > >> >so i am trying some thing out on localhost befor i move to dev >> >i want to know when my cf server was started or restarted. >> >so after my onApplicationStart >> >i put in a cfmail and fir up an instance of cf9 for my localhost. >> > >> >i dont get the email unless i actually goto 127.x.x.x to view a page. >> >i thought i should get it imeditaly when the server starts? >> > >> >how would or should i be doing this. >> >thanks a bunch. >> >will help to know when offshore reboots some thing with out informing us. >> > >> >-m >> > >> > >> > >> >> ~| 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:358275 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: onApplicationStart and cfmail, when doess server start?
thanks guys! i was unfamilar with onServerStart. looking now! Much appreciated! On Tue, Apr 1, 2014 at 11:44 AM, Bobby wrote: > > The behavior you explained is expected. onApplicationStart() isnšt > triggered until the first request to the application. > > Check out onServerStart and Server.cfc > > http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WS7AC9408A-1AC6-4ab7-9C8 > E-CF1DA8FCA16D.html > > > > > On 4/1/14, 11:31 AM, "morchella" wrote: > > > > >so i am trying some thing out on localhost befor i move to dev > >i want to know when my cf server was started or restarted. > >so after my onApplicationStart > >i put in a cfmail and fir up an instance of cf9 for my localhost. > > > >i dont get the email unless i actually goto 127.x.x.x to view a page. > >i thought i should get it imeditaly when the server starts? > > > >how would or should i be doing this. > >thanks a bunch. > >will help to know when offshore reboots some thing with out informing us. > > > >-m > > > > > > > > ~| 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:358274 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: onApplicationStart and cfmail, when doess server start?
The behavior you explained is expected. onApplicationStart() isn¹t triggered until the first request to the application. Check out onServerStart and Server.cfc http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WS7AC9408A-1AC6-4ab7-9C8 E-CF1DA8FCA16D.html On 4/1/14, 11:31 AM, "morchella" wrote: > >so i am trying some thing out on localhost befor i move to dev >i want to know when my cf server was started or restarted. >so after my onApplicationStart >i put in a cfmail and fir up an instance of cf9 for my localhost. > >i dont get the email unless i actually goto 127.x.x.x to view a page. >i thought i should get it imeditaly when the server starts? > >how would or should i be doing this. >thanks a bunch. >will help to know when offshore reboots some thing with out informing us. > >-m > > > ~| 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:358273 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: onApplicationStart and cfmail, when doess server start?
That is correct behavior. An application does not start until a page within its scope is requested. You have a few options though. Use onServerStart (CF 9+). Use another server to monitor it. Use a third party program such as FusionReactor. I highly recommend it and it's well worth the money spent. On Tue, Apr 1, 2014 at 10:31 AM, morchella wrote: > > so i am trying some thing out on localhost befor i move to dev > i want to know when my cf server was started or restarted. > so after my onApplicationStart > i put in a cfmail and fir up an instance of cf9 for my localhost. > > i dont get the email unless i actually goto 127.x.x.x to view a page. > i thought i should get it imeditaly when the server starts? > > how would or should i be doing this. > thanks a bunch. > will help to know when offshore reboots some thing with out informing us. > > -m > > > ~| 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:358272 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: onApplicationStart and cfmail, when doess server start?
ApplicationStart does not fire until the Application is hit. You're looking for onServerStart. On Tue, Apr 1, 2014 at 11:31 AM, morchella wrote: > > so i am trying some thing out on localhost befor i move to dev > i want to know when my cf server was started or restarted. > so after my onApplicationStart > i put in a cfmail and fir up an instance of cf9 for my localhost. > > i dont get the email unless i actually goto 127.x.x.x to view a page. > i thought i should get it imeditaly when the server starts? > > how would or should i be doing this. > thanks a bunch. > will help to know when offshore reboots some thing with out informing us. > > -m > > > ~| 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:358271 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
onApplicationStart and cfmail, when doess server start?
so i am trying some thing out on localhost befor i move to dev i want to know when my cf server was started or restarted. so after my onApplicationStart i put in a cfmail and fir up an instance of cf9 for my localhost. i dont get the email unless i actually goto 127.x.x.x to view a page. i thought i should get it imeditaly when the server starts? how would or should i be doing this. thanks a bunch. will help to know when offshore reboots some thing with out informing us. -m ~| 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:358270 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: What event specifically triggers OnApplicationStart?
Ian Skinner - I owe you an apology. After studying the access logs from the web server, I can't say with 100% certainty but it looks like this happened because someone hit the web server using an IP address. They didn't use the password to force a call to OnApplicationStart so it must have been right after a server reboot. I've rewritten that code to be more robust. :-) ~| 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:343419 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: What event specifically triggers OnApplicationStart?
Is it possible that someone is accessing your site by it's ip address, in an attempt to fool it into something that could enable a hacking attempt? I've seen security scanning software do similar things. This is why I tend to have the production state be the default state, and have development and stage be explicitly defined. That way, if the system is not sure which configuration to use, it uses the most secure. Mark Sent from my mobile device. On 29/03/2011 7:58 AM, "Dean Lawrence" wrote: > > Dave, > > Since your config is based on the cgi.server_name variable, why don't > you search your web server access logs for calls to your dev domain > name? This would tell you when and what was accessed which might have > reset your app. > > Dean > > On Mon, Mar 28, 2011 at 4:00 PM, Dave Burns wrote: >> >>>On 3/28/2011 11:10 AM, Dave Burns wrote: My code looks like this: configName = "dev" if CGI.SERVER_NAME contains "blah.com" configName = "production" >>> > > > -- > --- > Dean M. Lawrence > INTERNET DATA TECHNOLOGY > p // 888.438.4381 ext. 701 > w // www.idatatech.com > f // www.facebook.com/idatatech > t // www.twitter.com/idatatech > > Social Marketing | SEO | Design | Internet Developm > > ~| 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:343372 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: What event specifically triggers OnApplicationStart?
> Which means that if I (or any joker poking at your site to see if they > can do something) who requests your site by its IP address could set > your production server into dev mode. Not necessisarily, that would depend on how the web server was set to handle requests. One of my application has a similar setup and IIS will only pass the request to the application if the IP and hostname bindings are correct. If you made a request on the IP itself you'd just get a 301 response with a redirect to the main URL. Of course, if you knew the dev URL you could get into the application in development mode (also assuming you had proper credentials), but you couldn't put the live application into dev mode just by tweaking the HTTP request. -Justin ~| 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:343371 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: What event specifically triggers OnApplicationStart?
Dave, Since your config is based on the cgi.server_name variable, why don't you search your web server access logs for calls to your dev domain name? This would tell you when and what was accessed which might have reset your app. Dean On Mon, Mar 28, 2011 at 4:00 PM, Dave Burns wrote: > >>On 3/28/2011 11:10 AM, Dave Burns wrote: >>> My code looks like this: >>> >>> configName = "dev" >>> if CGI.SERVER_NAME contains "blah.com" >>> configName = "production" >> -- --- Dean M. Lawrence INTERNET DATA TECHNOLOGY p // 888.438.4381 ext. 701 w // www.idatatech.com f // www.facebook.com/idatatech t // www.twitter.com/idatatech Social Marketing | SEO | Design | Internet Developm ~| 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:343370 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: What event specifically triggers OnApplicationStart?
I suppose you haven't considered throwing some log recording in that area to help identify what might be going on? Regards, Andrew Scott http://www.andyscott.id.au/ > -Original Message- > From: Dave Burns [mailto:cft...@burnsorama.com] > Sent: Tuesday, 29 March 2011 6:44 AM > To: cf-talk > Subject: Re: What event specifically triggers OnApplicationStart? > > Since I don't get an exception thrown within OnApplicationStart, I can > assume that CGI is defined and CGI.SERVER_NAME is also defined. The only > thing I can say is that, assuming my theory is right, the value of > CGI.SERVER_NAME does not contain "blah.com" when I think it should. ~| 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:343369 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: What event specifically triggers OnApplicationStart?
>On 3/28/2011 11:10 AM, Dave Burns wrote: >> My code looks like this: >> >> configName = "dev" >> if CGI.SERVER_NAME contains "blah.com" >> configName = "production" > >Which means that if I (or any joker poking at your site to see if they >can do something) who requests your site by its IP address could set >your production server into dev mode. > >CGI.SERVER_NAME is probably populated, but it is populated by what I put >into MY browser, just as long as that resulted in a request to YOUR server. Well, since that code is in OnApplicationStart, only if you either a) knew the secret URL param and value to force a call to OnApplicationStart() or b) got lucky and were the very first page request to the app after a server restart. Both are possible but improbable. ~| 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:343368 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: What event specifically triggers OnApplicationStart?
On 3/28/2011 11:10 AM, Dave Burns wrote: > My code looks like this: > > configName = "dev" > if CGI.SERVER_NAME contains "blah.com" > configName = "production" Which means that if I (or any joker poking at your site to see if they can do something) who requests your site by its IP address could set your production server into dev mode. CGI.SERVER_NAME is probably populated, but it is populated by what I put into MY browser, just as long as that resulted in a request to YOUR server. ~| 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:343367 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: What event specifically triggers OnApplicationStart?
> On said diagnostic page, what is the value of CGI.SERVER_NAME and CGI. > HTTP_HOST when the configName's value is "dev"? Bill - That's the key question. My diagnostic page only dumps the current config, not how it got there. I'm going to change that. Since I don't get an exception thrown within OnApplicationStart, I can assume that CGI is defined and CGI.SERVER_NAME is also defined. The only thing I can say is that, assuming my theory is right, the value of CGI.SERVER_NAME does not contain "blah.com" when I think it should. ~| 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:343366 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: What event specifically triggers OnApplicationStart?
>One thing to keep in mind, if you do not have a *unique *ApplicationName on >your server, then the variables could be shared w/another application--which >is especially dangerous on shared hosting. > >I've seen people roll out an application w/a common ApplicationName like >"MainApp" and have issues w/their App scope being shared w/another >application that also used a name of "MainApp". Same thing happens if the >Application.cfc/cfm doesn't define a ApplicationName. > >IMO, the safest thing you can do is name define ever ApplicationName with a >hash of the current directory path: > > > >That way you can use the same code w/every Application.cfc, but your >virtually guaranteed to have a unique ApplicationName. > >-Dan > Dan - That's a good tip but the app name is unique and I've verified that there are no unintended conflicts by dumping the application object's variables. (But, yes, I'm on shared hosting - meant to say that.) ~| 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:343365 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: What event specifically triggers OnApplicationStart?
>I think I can see one possible cause of your problem Dave. >You may actually have 2 applications running. > >one on yourdomain.com >and another on www.yourdomain.com > >So if someone goes to yourdoamin.com and then www.yourdomain.com they will >NOT be seeing the same application. So perhaps most people go to >www.yourdomain.com, but every so often someone visits >yourdoamin.com instead, which would restart the application if it was >outside the timeout >period. > >To avoid this you need to add a redirect, so that only 1 domain is in use. >either redirect www.yourdoamin.com to yourdomain.com or vice versa. > >And also change your code to explicit to avoid this problem > >if CGI.SERVER_NAME IS "blah.com" > >else ... staging >else ... dev >else redirect to blah.com > Russ - I'm not sure I follow 100%. Whether the subdomain is there or not, IIS is configured to point to the same docroot so the same code will execute. I thought that the code manipulated the same application object if this.name was the same (which it is regardless of subdomain). Or am I missing something? ~| 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:343364 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: What event specifically triggers OnApplicationStart?
> Dave - For the sake of argument, if the server is restarted but no one hits a > single page on the app, OnApplicationStart won't run right? So if it > takes a page hit to call it, CGI should be defined, no? Yes, unless that page request comes through an event gateway I guess. > I just grepped my entire code base. The only call to onApplicationStart is my > code in OnRequestStart which looks for a magic URL param. Are you sure that hasn't been invoked? You might want to (a) add logging, or (b) grep your web server log files. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ http://training.figleaf.com/ Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA Schedule, and provides the highest caliber vendor-authorized instruction at our training centers, online, or onsite. ~| 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:343363 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: What event specifically triggers OnApplicationStart?
> It's entirely possible that (a) the server is stopping and restarting, > which will cause all applications to stop, or (b) there's an explicit > call to onApplicationStart somewhere within your code - this is > actually pretty common. Dave - For the sake of argument, if the server is restarted but no one hits a single page on the app, OnApplicationStart won't run right? So if it takes a page hit to call it, CGI should be defined, no? I just grepped my entire code base. The only call to onApplicationStart is my code in OnRequestStart which looks for a magic URL param. ~| 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:343362 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: What event specifically triggers OnApplicationStart?
One thing to keep in mind, if you do not have a *unique *ApplicationName on your server, then the variables could be shared w/another application--which is especially dangerous on shared hosting. I've seen people roll out an application w/a common ApplicationName like "MainApp" and have issues w/their App scope being shared w/another application that also used a name of "MainApp". Same thing happens if the Application.cfc/cfm doesn't define a ApplicationName. IMO, the safest thing you can do is name define ever ApplicationName with a hash of the current directory path: That way you can use the same code w/every Application.cfc, but your virtually guaranteed to have a unique ApplicationName. -Dan On Mon, Mar 28, 2011 at 2:55 PM, Russ Michaels wrote: > > I think I can see one possible cause of your problem Dave. > You may actually have 2 applications running. > > one on yourdomain.com > and another on www.yourdomain.com > > So if someone goes to yourdoamin.com and then www.yourdomain.com they will > NOT be seeing the same application. So perhaps most people go to > www.yourdomain.com, but every so often someone visits > yourdoamin.cominstead, which would restart the application if it was > outside the timeout > period. > > To avoid this you need to add a redirect, so that only 1 domain is in use. > either redirect www.yourdoamin.com to yourdomain.com or vice versa. > > And also change your code to explicit to avoid this problem > > if CGI.SERVER_NAME IS "blah.com" > > else ... staging > else ... dev > else redirect to blah.com > > > On Mon, Mar 28, 2011 at 7:46 PM, Dave Watts wrote: > > > > > > To confirm my understanding, are you saying that on a very busy site, > > it's possible that OnApplicationStart might never run again once the app > > > has started? (server admin and restarts aside.) > > > > That's exactly correct. > > > > > Since the app is running fine for months and then all of a sudden > > switches configs, something else then must trigger a call to > > OnApplicationStart > > > but with a screwy environment. (I'm going to add logging to track this > > down but I can't predict when the problem might happen again.) > > > > It's entirely possible that (a) the server is stopping and restarting, > > which will cause all applications to stop, or (b) there's an explicit > > call to onApplicationStart somewhere within your code - this is > > actually pretty common. > > > > Dave Watts, CTO, Fig Leaf Software > > http://www.figleaf.com/ > > http://training.figleaf.com/ > > > > Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on > > GSA Schedule, and provides the highest caliber vendor-authorized > > instruction at our training centers, online, or onsite. > > > > > > ~| 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:343361 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: What event specifically triggers OnApplicationStart?
I think I can see one possible cause of your problem Dave. You may actually have 2 applications running. one on yourdomain.com and another on www.yourdomain.com So if someone goes to yourdoamin.com and then www.yourdomain.com they will NOT be seeing the same application. So perhaps most people go to www.yourdomain.com, but every so often someone visits yourdoamin.cominstead, which would restart the application if it was outside the timeout period. To avoid this you need to add a redirect, so that only 1 domain is in use. either redirect www.yourdoamin.com to yourdomain.com or vice versa. And also change your code to explicit to avoid this problem if CGI.SERVER_NAME IS "blah.com" else ... staging else ... dev else redirect to blah.com On Mon, Mar 28, 2011 at 7:46 PM, Dave Watts wrote: > > > To confirm my understanding, are you saying that on a very busy site, > it's possible that OnApplicationStart might never run again once the app > > has started? (server admin and restarts aside.) > > That's exactly correct. > > > Since the app is running fine for months and then all of a sudden > switches configs, something else then must trigger a call to > OnApplicationStart > > but with a screwy environment. (I'm going to add logging to track this > down but I can't predict when the problem might happen again.) > > It's entirely possible that (a) the server is stopping and restarting, > which will cause all applications to stop, or (b) there's an explicit > call to onApplicationStart somewhere within your code - this is > actually pretty common. > > Dave Watts, CTO, Fig Leaf Software > http://www.figleaf.com/ > http://training.figleaf.com/ > > Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on > GSA Schedule, and provides the highest caliber vendor-authorized > instruction at our training centers, online, or onsite. > > ~| 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:343360 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: What event specifically triggers OnApplicationStart?
On said diagnostic page, what is the value of CGI.SERVER_NAME and CGI.HTTP_HOST when the configName's value is "dev"? -Original Message- From: Dave Burns [mailto:cft...@burnsorama.com] Sent: Monday, March 28, 2011 1:10 PM To: cf-talk Subject: Re: What event specifically triggers OnApplicationStart? >memory variables only timeout if they are not accessed the specified timeout >period. >every time anyone loads a page on your site, it accesses the application >scope and their session scope, so the timeout is reset back to 0. > >An application will restart when ColdFusion restarts, when you reach the >applicationTimeout, if you force a restart via code or via the >CFADMIN/server monitor To confirm my understanding, are you saying that on a very busy site, it's possible that OnApplicationStart might never run again once the app has started? (server admin and restarts aside.) Since the app is running fine for months and then all of a sudden switches configs, something else then must trigger a call to OnApplicationStart but with a screwy environment. (I'm going to add logging to track this down but I can't predict when the problem might happen again.) >When you say you use cgi.server_name to determine which variables to use, >are you being VERY explicity, as in the SERVER_NAME must match EXACTLY, or >are you doing an if/else to say if its this then set as live else set as dev? My code looks like this: configName = "dev" if CGI.SERVER_NAME contains "blah.com" configName = "production" I can tell from a diagnostic page I have that configName's value ended up being "dev". Fixing the problem is as easy as forcing a call to OnApplicationStart by hitting a special URL. Which makes me wonder under what circumstances OnApplicationStart can be called without CGI being set properly. Strange. ~| 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:343359 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: What event specifically triggers OnApplicationStart?
> To confirm my understanding, are you saying that on a very busy site, it's > possible that OnApplicationStart might never run again once the app > has started? (server admin and restarts aside.) That's exactly correct. > Since the app is running fine for months and then all of a sudden switches > configs, something else then must trigger a call to OnApplicationStart > but with a screwy environment. (I'm going to add logging to track this down > but I can't predict when the problem might happen again.) It's entirely possible that (a) the server is stopping and restarting, which will cause all applications to stop, or (b) there's an explicit call to onApplicationStart somewhere within your code - this is actually pretty common. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ http://training.figleaf.com/ Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA Schedule, and provides the highest caliber vendor-authorized instruction at our training centers, online, or onsite. ~| 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:343358 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: What event specifically triggers OnApplicationStart?
>memory variables only timeout if they are not accessed the specified timeout >period. >every time anyone loads a page on your site, it accesses the application >scope and their session scope, so the timeout is reset back to 0. > >An application will restart when ColdFusion restarts, when you reach the >applicationTimeout, if you force a restart via code or via the >CFADMIN/server monitor To confirm my understanding, are you saying that on a very busy site, it's possible that OnApplicationStart might never run again once the app has started? (server admin and restarts aside.) Since the app is running fine for months and then all of a sudden switches configs, something else then must trigger a call to OnApplicationStart but with a screwy environment. (I'm going to add logging to track this down but I can't predict when the problem might happen again.) >When you say you use cgi.server_name to determine which variables to use, >are you being VERY explicity, as in the SERVER_NAME must match EXACTLY, or >are you doing an if/else to say if its this then set as live else set as dev? My code looks like this: configName = "dev" if CGI.SERVER_NAME contains "blah.com" configName = "production" I can tell from a diagnostic page I have that configName's value ended up being "dev". Fixing the problem is as easy as forcing a call to OnApplicationStart by hitting a special URL. Which makes me wonder under what circumstances OnApplicationStart can be called without CGI being set properly. Strange. ~| 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:343357 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: What event specifically triggers OnApplicationStart?
memory variables only timeout if they are not accessed the specified timeout period. every time anyone loads a page on your site, it accesses the application scope and their session scope, so the timeout is reset back to 0. An application will restart when ColdFusion restarts, when you reach the applicationTimeout, if you force a restart via code or via the CFADMIN/server monitor When you say you use cgi.server_name to determine which variables to use, are you being VERY explicity, as in the SERVER_NAME must match EXACTLY, or are you doing an if/else to say if its this then set as live else set as dev ? On Mon, Mar 28, 2011 at 6:25 PM, Dave Burns wrote: > > In Application.cfc, I know that OnApplicationStart is called when an > application starts. I'd like to define that better. From what I've read, > this is when the first page is requested from an app (also possible are > event gateways and Flash remoting but I'm not using either). So, if I say: > > this.applicationTimeout = CreateTimeSpan(1, 0, 0, 0); > > in my Application.cfc and a day goes by since calling OnApplicationStart, > isn't it true that the server doesn't invoke my code on its own (like a cron > job). It waits for a day to go by and then invokes OnApplicationStart on the > next page request - even if that request is hours later? > > I'm asking because I'm trying to track down some odd behavior in a > customer's app. The OnApplicationStart code looks at CGI.SERVER_NAME to > determine which config file to load (production, staging, dev, etc.). Twice > in the last 6 months, the production system starts to think it's a dev > system. Are there cases where CGI.SERVER_NAME could be empty or undefined > or... when OnApplicationStart is called? Can I trust that CGI var's are > always set correctly in this scenario? > > > > ~| 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:343353 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
What event specifically triggers OnApplicationStart?
In Application.cfc, I know that OnApplicationStart is called when an application starts. I'd like to define that better. From what I've read, this is when the first page is requested from an app (also possible are event gateways and Flash remoting but I'm not using either). So, if I say: this.applicationTimeout = CreateTimeSpan(1, 0, 0, 0); in my Application.cfc and a day goes by since calling OnApplicationStart, isn't it true that the server doesn't invoke my code on its own (like a cron job). It waits for a day to go by and then invokes OnApplicationStart on the next page request - even if that request is hours later? I'm asking because I'm trying to track down some odd behavior in a customer's app. The OnApplicationStart code looks at CGI.SERVER_NAME to determine which config file to load (production, staging, dev, etc.). Twice in the last 6 months, the production system starts to think it's a dev system. Are there cases where CGI.SERVER_NAME could be empty or undefined or... when OnApplicationStart is called? Can I trust that CGI var's are always set correctly in this scenario? ~| 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:343352 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: onApplicationStart
Something a bit simpler may be to use the ApplicationStop function. From QuickDocs: http://cfquickdocs.com/cf9/?getDoc=applicationstopDescription Stops or resets the current application. The application is restarted on the next request to the application. As a caveat, its CF9 only so far. hth, larry >You can have a cfif looking for a url variable such as reset. Inside the >CFIF you can recall the onapplicationstart method > > > > >Personally, I'd go for a separate reset page. Why have a CFIF if it will >rarely, if ever used. > >On Jan 3, 2008 3:01 PM, Adkins, Randy wrote: > >> ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336012 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: onApplicationStart
Huh, not sure what happened with the formatting on that. Here you go: Thanks, Eric Cobb ECAR Technologies, LLC http://www.ecartech.com http://www.cfgears.com Eric Cobb wrote: > Here's the poor mans answer to applicationStop(), it works on CF7 & CF8. > > |<||cfset| |application.setIsInited(false) /> > | > See Mister Dai for a more detailed explanation: > http://misterdai.wordpress.com/2010/06/11/cf-flag-application-to-run-onapplicationstart/ > | > | > > Thanks, > > Eric Cobb > ECAR Technologies, LLC > http://www.ecartech.com > http://www.cfgears.com > > > > Raymond Camden wrote: > >> That's by design. CF knows when an application starts. You can 'force' >> it a few ways. >> >> 1) In CF9, within onRequestStart, add a check for url.init (or some >> such), and run applicationStop(), you then need to reload the current >> request. >> 2) Or even simpler, within onRequestStart, add a check for a url var >> and simply do >> >> onApplicationStart(); >> >> This will NOT single thread the call, but if you are just setting up a >> bunch of variables, you most likely do not need to be concerned. >> >> 3) I don't really recommend this, but you can also just rename the >> application. >> >> >> On Wed, Aug 4, 2010 at 2:56 PM, Matt Coldfusion wrote: >> >> >>> This doesnt work for me and I cannot work out why? >>> I run onApplicationStart in application.cfc and all my old application >>> variables still exist, i have to restart the service all the time but i >>> can't do this on my shared server. >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>>>> What is another way besides creating a temp file to explicitly reset >>>>> those variables? >>>>> Is there a way to make the Application expire and restart (sort of >>>>> speak)? >>>>> >>>>> >>>> Here's what I use: >>>> >>>> >>>> >>>>>>> throwontimeout="true"> >>>> >>>> >>>> >>>> >>>> >>>> Then add ?reinitApp=1 in any url to restart the app >>>> >>>> Will >>>> >>>> >>> >>> >> > > ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:335999 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: onApplicationStart
Here's the poor mans answer to applicationStop(), it works on CF7 & CF8. |<||cfset| |application.setIsInited(false) /> | See Mister Dai for a more detailed explanation: http://misterdai.wordpress.com/2010/06/11/cf-flag-application-to-run-onapplicationstart/ | | Thanks, Eric Cobb ECAR Technologies, LLC http://www.ecartech.com http://www.cfgears.com Raymond Camden wrote: > That's by design. CF knows when an application starts. You can 'force' > it a few ways. > > 1) In CF9, within onRequestStart, add a check for url.init (or some > such), and run applicationStop(), you then need to reload the current > request. > 2) Or even simpler, within onRequestStart, add a check for a url var > and simply do > > onApplicationStart(); > > This will NOT single thread the call, but if you are just setting up a > bunch of variables, you most likely do not need to be concerned. > > 3) I don't really recommend this, but you can also just rename the > application. > > > On Wed, Aug 4, 2010 at 2:56 PM, Matt Coldfusion wrote: > >> This doesnt work for me and I cannot work out why? >> I run onApplicationStart in application.cfc and all my old application >> variables still exist, i have to restart the service all the time but i >> can't do this on my shared server. >> >> >> >> >> >> >> >> >> >>>> What is another way besides creating a temp file to explicitly reset >>>> those variables? >>>> Is there a way to make the Application expire and restart (sort of >>>> speak)? >>>> >>> Here's what I use: >>> >>> >>> >>>>> throwontimeout="true"> >>> >>> >>> >>> >>> >>> Then add ?reinitApp=1 in any url to restart the app >>> >>> Will >>> >> > > ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:335997 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: onApplicationStart
That's by design. CF knows when an application starts. You can 'force' it a few ways. 1) In CF9, within onRequestStart, add a check for url.init (or some such), and run applicationStop(), you then need to reload the current request. 2) Or even simpler, within onRequestStart, add a check for a url var and simply do onApplicationStart(); This will NOT single thread the call, but if you are just setting up a bunch of variables, you most likely do not need to be concerned. 3) I don't really recommend this, but you can also just rename the application. On Wed, Aug 4, 2010 at 2:56 PM, Matt Coldfusion wrote: > > This doesnt work for me and I cannot work out why? > I run onApplicationStart in application.cfc and all my old application > variables still exist, i have to restart the service all the time but i can't > do this on my shared server. > > > > > > > > >>>What is another way besides creating a temp file to explicitly reset >>>those variables? >>>Is there a way to make the Application expire and restart (sort of >>>speak)? >> >>Here's what I use: >> >> >> >> > throwontimeout="true"> >> >> >> >> >> >>Then add ?reinitApp=1 in any url to restart the app >> >>Will > > ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:335996 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: onApplicationStart
This doesnt work for me and I cannot work out why? I run onApplicationStart in application.cfc and all my old application variables still exist, i have to restart the service all the time but i can't do this on my shared server. >>What is another way besides creating a temp file to explicitly reset >>those variables? >>Is there a way to make the Application expire and restart (sort of >>speak)? > >Here's what I use: > > > > throwontimeout="true"> > > > > > >Then add ?reinitApp=1 in any url to restart the app > >Will ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:335994 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: onApplicationStart Vs onRequestStart
The whole point of putting variables into the application scope is to cache them so you don't have to set them on every request. The reason your variables didn't get set after you added new ones was that your application had already started; OnApplicationStart doesn't run on every request. mxAjax / CFAjax docs and other useful articles: http://www.bifrost.com.au/blog/ 2008/9/29 Sherif Abdou > Oh Ok I found what the problem is, I guess my Varaibles in the > onApplicationStart got cached, so when I sent it once, launched and then I > added another Variables after launched again the application variables > dont' > get updated. Now How would i prevent it from getting cached? > -- ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313196 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: onApplicationStart Vs onRequestStart
Oh Ok I found what the problem is, I guess my Varaibles in the onApplicationStart got cached, so when I sent it once, launched and then I added another Variables after launched again the application variables dont' get updated. Now How would i prevent it from getting cached? -- Sherif Abdou http://VadexFX.com http://Sherifabdou.com - Original Message - From: "s. isaac dealey" <[EMAIL PROTECTED]> To: "cf-talk" Sent: Sunday, September 28, 2008 8:42 PM Subject: Re: onApplicationStart Vs onRequestStart >> I am new to ColdFusion and I am having trouble understanding what is the >> Difference between onApplicationStart method and onRequestStart method >> other >> than the Scope. For Example what does it mean by Application? First time >> a >> user comes to your site? Does it only run once? I tried to set a Variable >> in >> the onApplicationStart method like >> and I get an Error when I say use it in index.cfm. Am i allowed to use >> this >> outside in other files Or anything that gets set in onApplicationStart >> gets >> passed to onApplicationEnd and thats where the variable get used? Thanks. > > Hi Sherif, > > Welcome to the community. :) > > The onApplicationStart and onRequest start events are simply events > which occur at a given time and aren't actually tied to any variable > scopes, other than the fact that onApplicationStart executes immediately > after the application scope is created. But you can do whatever you want > to in that method. For example, you can create request variables in the > onApplicationStart method, even though it executes before onRequestStart. > > So the lifespan of an application looks like this: > > 1. onApplicationStart > > 2. onSessionStart > > 3. onRequestStart > 4. index.cfm > 5. onRequestEnd > > 6. return to 3 (onRequestStart) and repeat > > 7. onSessionEnd - user timed out > 8. return to 2 (onSessionStart) and repeat for other users > > 9. onApplicationEnd - application timed out > > 10. return to 1 (onApplicationStart) the next time the site is visited > > You can use application variables in index.cfm -- they need to be > properly scoped, but if you set them in the onApplicationStart method > they should be available. Your onApplicationStart method may not be > executing if you haven't specified a name for your application. So your > Application.cfc should look similar to this: > > > > > > > > > > > > You can also look to see what variables you have in your application > scope from your index.cfm template by dumping the structure like this: > > > > hth > > -- > s. isaac dealey ^ new epoch > isn't it time for a change? > ph: 781.769.0723 > > http://onTap.riaforge.org/blog > > > > ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313195 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: onApplicationStart Vs onRequestStart
> I am new to ColdFusion and I am having trouble understanding what is the > Difference between onApplicationStart method and onRequestStart method other > than the Scope. For Example what does it mean by Application? First time a > user comes to your site? Does it only run once? I tried to set a Variable in > the onApplicationStart method like > and I get an Error when I say use it in index.cfm. Am i allowed to use this > outside in other files Or anything that gets set in onApplicationStart gets > passed to onApplicationEnd and thats where the variable get used? Thanks. Hi Sherif, Welcome to the community. :) The onApplicationStart and onRequest start events are simply events which occur at a given time and aren't actually tied to any variable scopes, other than the fact that onApplicationStart executes immediately after the application scope is created. But you can do whatever you want to in that method. For example, you can create request variables in the onApplicationStart method, even though it executes before onRequestStart. So the lifespan of an application looks like this: 1. onApplicationStart 2. onSessionStart 3. onRequestStart 4. index.cfm 5. onRequestEnd 6. return to 3 (onRequestStart) and repeat 7. onSessionEnd - user timed out 8. return to 2 (onSessionStart) and repeat for other users 9. onApplicationEnd - application timed out 10. return to 1 (onApplicationStart) the next time the site is visited You can use application variables in index.cfm -- they need to be properly scoped, but if you set them in the onApplicationStart method they should be available. Your onApplicationStart method may not be executing if you haven't specified a name for your application. So your Application.cfc should look similar to this: You can also look to see what variables you have in your application scope from your index.cfm template by dumping the structure like this: hth -- s. isaac dealey ^ new epoch isn't it time for a change? ph: 781.769.0723 http://onTap.riaforge.org/blog ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313193 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: onApplicationStart Vs onRequestStart
OnApplicationStart runs the first time ANY user hits your site. It's commonly used for setting application variables that rarely change. Things like datasources are a good place for that or initializing a ton of cfobjects. I commonly put a cfif statement in my onRequest event to reset the application variables. like this: That way if you can rerun the function from any request. Steve On Sun, Sep 28, 2008 at 8:57 PM, Sherif Abdou <[EMAIL PROTECTED]>wrote: > I am new to ColdFusion and I am having trouble understanding what is the > Difference between onApplicationStart method and onRequestStart method > other > than the Scope. For Example what does it mean by Application? First time a > user comes to your site? Does it only run once? I tried to set a Variable > in > the onApplicationStart method like > and I get an Error when I say use it in index.cfm. Am i allowed to use this > outside in other files Or anything that gets set in onApplicationStart gets > passed to onApplicationEnd and thats where the variable get used? Thanks. > > > > ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313192 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: onApplicationStart Vs onRequestStart
>I am new to ColdFusion and I am having trouble understanding what is the >Difference between onApplicationStart method and onRequestStart method other >than the Scope. For Example what does it mean by Application? First time a onapplicationstart() runs when the first cfm or cfc is executed in your application. onrequeststart() runs every page request. Yes, you can set application-wide variables in onapplicationstart(). Check it out and see what's there. Will ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313191 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
onApplicationStart Vs onRequestStart
I am new to ColdFusion and I am having trouble understanding what is the Difference between onApplicationStart method and onRequestStart method other than the Scope. For Example what does it mean by Application? First time a user comes to your site? Does it only run once? I tried to set a Variable in the onApplicationStart method like and I get an Error when I say use it in index.cfm. Am i allowed to use this outside in other files Or anything that gets set in onApplicationStart gets passed to onApplicationEnd and thats where the variable get used? Thanks. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313190 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: onApplicationStart
On Jan 3, 2008 12:24 PM, Raymond Camden <[EMAIL PROTECTED]> wrote: > Just note though - that lock isn't really necessary if all you are > doing is setting a bunch of simple values in the app scope. And by > simple I mean things that dont' need to be single threaded. A CFC > stored in the app scope is most likely fine as well. Careful! That's not necessarily true if there are multiple variables and the integrity of the code relies on them not being set inconsistently. In other words, race condition *can* still apply here depending on how atomic the initialization code is... As for the CFC, if you have init code like this: application.someVar = createObject("component","MyThing"); application.someVar.someMethod(42); then that may well not be safe either - in particular if "someMethod" is actually "init"! - because the application code may depend on someVar being in at least the state that someMethod() puts it in (and other requests could access application.someVar after the createObject() but before the someMethod() call). A safer way to do that initialization is: var someVar = createObject("component","MyThing"); someVar.someMethod(42); application.someVar = someVar; i.e., fully initialize the component before placing it in application scope. -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ "If you're not annoying somebody, you're not really alive." -- Margaret Atwood ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:295800 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: onApplicationStart
You can also temporiarly set the session timeout to 0 or some other really short time, let the application expire, then return the timeout to the desired value. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:295788 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: onApplicationStart
Just note though - that lock isn't really necessary if all you are doing is setting a bunch of simple values in the app scope. And by simple I mean things that dont' need to be single threaded. A CFC stored in the app scope is most likely fine as well. On Jan 3, 2008 1:59 PM, Will Tomlinson <[EMAIL PROTECTED]> wrote: > >What is another way besides creating a temp file to explicitly reset > >those variables? > >Is there a way to make the Application expire and restart (sort of > >speak)? > > Here's what I use: > > > > throwontimeout="true"> > > > > > > Then add ?reinitApp=1 in any url to restart the app > > Will > > ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:295790 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: onApplicationStart
You can try putting most of your OnApplicationStart code into cfinclude files and call those cfinclude file in some other reload page. This has an advantage over calling OnApplicationStart again if there are some things that OnApplicationStart does that you don't want to do a second time, such as reinitializing a list of logged-in users. If you just want to reload some application-scope variables or some cached functions, calling the entire OnApplicationStart again might be overkill. Another way to do this is to put conditionals in the OnApplicationStart block that only reinitializes certain sections depending on the input variables (commonly a URL variable). My guess is that you don't actually want to expire the application in order to reload a few variables. If you do want to expire the application, there are ways to do this. Setting the application timeout = 0 is one way. -Mike Chabot On Jan 3, 2008 3:06 PM, Brian Kotek <[EMAIL PROTECTED]> wrote: > You can just call onApplicationStart() again, but be aware that it won't be > thread safe as it is when the application starts up. > > On Jan 3, 2008 3:01 PM, Adkins, Randy <[EMAIL PROTECTED]> wrote: > > > Question: > > When using the onApplicationStart within an Application.cfc, lets say I > > wanted to restart the Application to pickup some changes. > > Now I know you can cycle the CF Services but I do not have that access > > to the server. > > > > What is another way besides creating a temp file to explicitly reset > > those variables? > > Is there a way to make the Application expire and restart (sort of > > speak)? > > > > > > > > > > > > > > ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:295789 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: onApplicationStart
Sweet.. thanks -Original Message- From: Will Tomlinson [mailto:[EMAIL PROTECTED] Sent: Thursday, January 03, 2008 3:00 PM To: CF-Talk Subject: Re: onApplicationStart >What is another way besides creating a temp file to explicitly reset >those variables? >Is there a way to make the Application expire and restart (sort of >speak)? Here's what I use: Then add ?reinitApp=1 in any url to restart the app Will ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:295787 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: onApplicationStart
No, not really. I put all my initialization logic in a separate method of Application.cfc, and then invoke that method from onRequestStart if certain conditions are met (usually the presence of a "reloadApplication" URL param that is set to a specific value). Note that this doesn't expire the application, it just reinitializes it. So any pre-existing application variables will continue to exist unless your initialization explicitly overwrites or deletes them. cheers, barneyb On Jan 3, 2008 12:01 PM, Adkins, Randy <[EMAIL PROTECTED]> wrote: > Question: > When using the onApplicationStart within an Application.cfc, lets say I > wanted to restart the Application to pickup some changes. > Now I know you can cycle the CF Services but I do not have that access > to the server. > > What is another way besides creating a temp file to explicitly reset > those variables? > Is there a way to make the Application expire and restart (sort of > speak)? > -- Barney Boisvert [EMAIL PROTECTED] http://www.barneyb.com/ Got Gmail? I have 100 invites. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:295783 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: onApplicationStart
>What is another way besides creating a temp file to explicitly reset >those variables? >Is there a way to make the Application expire and restart (sort of >speak)? Here's what I use: Then add ?reinitApp=1 in any url to restart the app Will ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:295784 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: onApplicationStart
You can have a cfif looking for a url variable such as reset. Inside the CFIF you can recall the onapplicationstart method Personally, I'd go for a separate reset page. Why have a CFIF if it will rarely, if ever used. On Jan 3, 2008 3:01 PM, Adkins, Randy <[EMAIL PROTECTED]> wrote: > Question: > When using the onApplicationStart within an Application.cfc, lets say I > wanted to restart the Application to pickup some changes. > Now I know you can cycle the CF Services but I do not have that access > to the server. > > What is another way besides creating a temp file to explicitly reset > those variables? > Is there a way to make the Application expire and restart (sort of > speak)? > > > > > > ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:295786 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: onApplicationStart
You can just call onApplicationStart() again, but be aware that it won't be thread safe as it is when the application starts up. On Jan 3, 2008 3:01 PM, Adkins, Randy <[EMAIL PROTECTED]> wrote: > Question: > When using the onApplicationStart within an Application.cfc, lets say I > wanted to restart the Application to pickup some changes. > Now I know you can cycle the CF Services but I do not have that access > to the server. > > What is another way besides creating a temp file to explicitly reset > those variables? > Is there a way to make the Application expire and restart (sort of > speak)? > > > > > > ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:295782 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
onApplicationStart
Question: When using the onApplicationStart within an Application.cfc, lets say I wanted to restart the Application to pickup some changes. Now I know you can cycle the CF Services but I do not have that access to the server. What is another way besides creating a temp file to explicitly reset those variables? Is there a way to make the Application expire and restart (sort of speak)? ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:295780 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: onApplicationStart & cftry
It was pretty serious at the time. Seemed to be a problem with the JVM garbage collection but is sorted now. It affected a handful of sites connecting to the SQL server. One of them was failing on the connection & storage for the client & session varaibles, so I was thinking if this ever happened again it'd be good to be able to test for it in the code. Fingers crossed it won't though :) ~| Create robust enterprise, web RIAs. Upgrade & integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:266583 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: onApplicationStart & cftry
Well, if your client storage fails, thats pretty bad. To me it's the kind of thing you wouldn't try catch as it means a serious problem. On 1/14/07, Richard Cooper <[EMAIL PROTECTED]> wrote: > Gotcha. Thanks Ray. > > Do you know about the clientStorage bit? I had a problem a while back when I > had DB problems and the storage of client and session variables. I'm pretrty > sure that this was happening straight away in the first line of > application.cfm, within the thrown due to a failed connection. > > I was thinking that either by wrapping the OnSessionStart function would check for this? > > ~| Create robust enterprise, web RIAs. Upgrade & integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:266569 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: onApplicationStart & cftry
Gotcha. Thanks Ray. Do you know about the clientStorage bit? I had a problem a while back when I had DB problems and the storage of client and session variables. I'm pretrty sure that this was happening straight away in the first line of application.cfm, within the http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:266563 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: onApplicationStart & cftry
I think the idea is to cache the check and not rerun it on every request, which could be wasteful. It is a trade off. I'd probably use onRequestStart, and cache the last check time, and only check once an hour. Maybe. :) On 1/14/07, Richard Cooper <[EMAIL PROTECTED]> wrote: > Hi, > > I've seen a few examples where this happens, but, I'm a little confused as to > why you'd use cftry/cfcatch to test for a DB connection within > onApplicationstart. > > Firstly, would this mean that until the application ends it would consider > that the database is unreachable? > > Secondly, what happens when the DB goes down later on, after the application > has started? Wouldn't it be better to have this test within onRequestStart? > > Lastly (and slightly separately), if I store client details in a DB and this > connection is down I'm assuming this problem would occur prior to the > onApplicationStart? Would it be best to wrap that in try/catch as well or > perhaps even instead of? > > > etc... > > > > ~| Create robust enterprise, web RIAs. Upgrade & integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:266551 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
onApplicationStart & cftry
Hi, I've seen a few examples where this happens, but, I'm a little confused as to why you'd use cftry/cfcatch to test for a DB connection within onApplicationstart. Firstly, would this mean that until the application ends it would consider that the database is unreachable? Secondly, what happens when the DB goes down later on, after the application has started? Wouldn't it be better to have this test within onRequestStart? Lastly (and slightly separately), if I store client details in a DB and this connection is down I'm assuming this problem would occur prior to the onApplicationStart? Would it be best to wrap that in try/catch as well or perhaps even instead of? etc... ~| Create robust enterprise, web RIAs. Upgrade & integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:266544 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: can't get onApplicationStart to fire...
Aha - thats what i was missing. So in order to use the onApplication and onSession methods you need to initialise the application in application.cfc, except instead of using the tag you set the the parameters in the This scope. In other words, Application.cfc replaces both Application.cfm and (unless you only want to use the onRequest methods) Thanks Bert On Fri, 11 Feb 2005 22:29:51 +0800, James Holmes <[EMAIL PROTECTED]> wrote: > Does it work if you use Application.cfc to set the app paramaters? > > http://livedocs.macromedia.com/coldfusion/7/htmldocs/1115.htm > ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:194264 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
RE: can't get onApplicationStart to fire...
No, you don't need to call it manually. Does it work if you use Application.cfc to set the app paramaters? http://livedocs.macromedia.com/coldfusion/7/htmldocs/1115.htm -Original Message- From: Bert Dawson [mailto:[EMAIL PROTECTED] Sent: Friday, 11 February 2005 9:27 To: CF-Talk Subject: Re: can't get onApplicationStart to fire... I'm confused now: I'm i right in thinking that onApplicationStart() should fire automatically when the application starts? And by "application starting" i mean the first time a cfapplication tag with a particular application name is run (assuming server has just restarted). If thats correct then i can't get it to work: my onApplicationStart() never fires. Or am i supposed to call it manually: ie Cheers Bert On Fri, 11 Feb 2005 06:36:19 -0600, Raymond Camden <[EMAIL PROTECTED]> wrote: > You may also want to consider a very low app timeout while testing. > You may also want to consider putting something like this in your > onRequestStart: > > if isDefined("url.reinit") onApplicationStart() > > Unfortunately, this will only run you rmethod. It will not "reset" the > Application like a true restart. But in most cases you don't really > care. > > I've already bugged MACR about adding a "real" way to programatically > restart an App/Session. > > ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:194240 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
Re: can't get onApplicationStart to fire...
I'm confused now: I'm i right in thinking that onApplicationStart() should fire automatically when the application starts? And by "application starting" i mean the first time a cfapplication tag with a particular application name is run (assuming server has just restarted). If thats correct then i can't get it to work: my onApplicationStart() never fires. Or am i supposed to call it manually: ie Cheers Bert On Fri, 11 Feb 2005 06:36:19 -0600, Raymond Camden <[EMAIL PROTECTED]> wrote: > You may also want to consider a very low app timeout while testing. > You may also want to consider putting something like this in your > onRequestStart: > > if isDefined("url.reinit") onApplicationStart() > > Unfortunately, this will only run you rmethod. It will not "reset" the > Application like a true restart. But in most cases you don't really > care. > > I've already bugged MACR about adding a "real" way to programatically > restart an App/Session. > > ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:194230 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
Re: can't get onApplicationStart to fire...
But I'm using createUUID() as the application name to ensure the application always starts on every request... (I'm only doing this cos i got bored of changing the name everytime i tweaked Application.cfc to try and get it to work) And either i'm using the same session, in which case session.startup should already be set, or its a new session, in which case it should be set. Or am i missing something? Bert On Fri, 11 Feb 2005 07:01:49 -0500, Calvin Ward <[EMAIL PROTECTED]> wrote: > Because if you don't restart CF then the Application is already started and > onApplicationStart will never fire. The Application starts on the first > browser request to the CF server after the CF server is started. > > Additionally, you may want to close and re-open your browser to get > onSessionStart to fire. > > - Calvin > > -Original Message- > From: Bert Dawson [mailto:[EMAIL PROTECTED] > Sent: Friday, February 11, 2005 6:50 AM > To: CF-Talk > Subject: Re: can't get onApplicationStart to fire... > > No, but then why should i? If the methods were getting called then the > ?.started variables would be getting set, but only request.started is > getting set. > > Bert > > On Fri, 11 Feb 2005 06:32:53 -0500, Calvin Ward <[EMAIL PROTECTED]> wrote: > > Are you restarting CF before you request index.cfm? > > > > -Original Message- > > From: Bert Dawson [mailto:[EMAIL PROTECTED] > > Sent: Friday, February 11, 2005 5:48 AM > > To: CF-Talk > > Subject: can't get onApplicationStart to fire... > > > > I can't seem to get onApplicationStart to run, nor onSessionStart, but > > on request start works fine. I'd be grateful if someone could caste an > > eye over my code to see if they can spot what i'm doing wrong: > > 2 files in a directory: Application.cfc and index.cfm: > > -- > > Application.cfc: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > index.cfm: > > > clientmanagement="No" > > sessionmanagement="Yes" > > setclientcookies="No"> > > > > > > > > > > > > > > -- > > > > When i run index.cfm only request.started has been set (plus > > application.name, session.jsessionid and session.urltoken, and > > request.cfdumpinited). > > TIA > > Bert > > > > > > ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:194224 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
Re: can't get onApplicationStart to fire...
You may also want to consider a very low app timeout while testing. You may also want to consider putting something like this in your onRequestStart: if isDefined("url.reinit") onApplicationStart() Unfortunately, this will only run you rmethod. It will not "reset" the Application like a true restart. But in most cases you don't really care. I've already bugged MACR about adding a "real" way to programatically restart an App/Session. On Fri, 11 Feb 2005 07:01:49 -0500, Calvin Ward <[EMAIL PROTECTED]> wrote: > Because if you don't restart CF then the Application is already started and > onApplicationStart will never fire. The Application starts on the first > browser request to the CF server after the CF server is started. > > Additionally, you may want to close and re-open your browser to get > onSessionStart to fire. > > - Calvin > > -Original Message- > From: Bert Dawson [mailto:[EMAIL PROTECTED] > Sent: Friday, February 11, 2005 6:50 AM > To: CF-Talk > Subject: Re: can't get onApplicationStart to fire... > > No, but then why should i? If the methods were getting called then the > ?.started variables would be getting set, but only request.started is > getting set. > > Bert > > On Fri, 11 Feb 2005 06:32:53 -0500, Calvin Ward <[EMAIL PROTECTED]> wrote: > > Are you restarting CF before you request index.cfm? > > > > -Original Message- > > From: Bert Dawson [mailto:[EMAIL PROTECTED] > > Sent: Friday, February 11, 2005 5:48 AM > > To: CF-Talk > > Subject: can't get onApplicationStart to fire... > > > > I can't seem to get onApplicationStart to run, nor onSessionStart, but > > on request start works fine. I'd be grateful if someone could caste an > > eye over my code to see if they can spot what i'm doing wrong: > > 2 files in a directory: Application.cfc and index.cfm: > > -- > > Application.cfc: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > index.cfm: > > > clientmanagement="No" > > sessionmanagement="Yes" > > setclientcookies="No"> > > > > > > > > > > > > > > -- > > > > When i run index.cfm only request.started has been set (plus > > application.name, session.jsessionid and session.urltoken, and > > request.cfdumpinited). > > TIA > > Bert > > > > > > ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:194222 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
RE: can't get onApplicationStart to fire...
Slight amendment The below should read " Because if you don't restart CF then the Application is already started and onApplicationStart will never fire. The Application starts on the first request to the CF server that requests that Application.cfc (or another template that contains the cfapplication tag with that application name) after the CF server is started." - Calvin -Original Message- From: Calvin Ward [mailto:[EMAIL PROTECTED] Sent: Friday, February 11, 2005 7:02 AM To: CF-Talk Subject: RE: can't get onApplicationStart to fire... Because if you don't restart CF then the Application is already started and onApplicationStart will never fire. The Application starts on the first browser request to the CF server after the CF server is started. Additionally, you may want to close and re-open your browser to get onSessionStart to fire. - Calvin -Original Message- From: Bert Dawson [mailto:[EMAIL PROTECTED] Sent: Friday, February 11, 2005 6:50 AM To: CF-Talk Subject: Re: can't get onApplicationStart to fire... No, but then why should i? If the methods were getting called then the ?.started variables would be getting set, but only request.started is getting set. Bert On Fri, 11 Feb 2005 06:32:53 -0500, Calvin Ward <[EMAIL PROTECTED]> wrote: > Are you restarting CF before you request index.cfm? > > -Original Message- > From: Bert Dawson [mailto:[EMAIL PROTECTED] > Sent: Friday, February 11, 2005 5:48 AM > To: CF-Talk > Subject: can't get onApplicationStart to fire... > > I can't seem to get onApplicationStart to run, nor onSessionStart, but > on request start works fine. I'd be grateful if someone could caste an > eye over my code to see if they can spot what i'm doing wrong: > 2 files in a directory: Application.cfc and index.cfm: > -- > Application.cfc: > > > > > > > > > > > > > > > > > > -- > index.cfm: > clientmanagement="No" > sessionmanagement="Yes" > setclientcookies="No"> > > > > > > > -- > > When i run index.cfm only request.started has been set (plus > application.name, session.jsessionid and session.urltoken, and > request.cfdumpinited). > TIA > Bert > > ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:194220 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
RE: can't get onApplicationStart to fire...
Because if you don't restart CF then the Application is already started and onApplicationStart will never fire. The Application starts on the first browser request to the CF server after the CF server is started. Additionally, you may want to close and re-open your browser to get onSessionStart to fire. - Calvin -Original Message- From: Bert Dawson [mailto:[EMAIL PROTECTED] Sent: Friday, February 11, 2005 6:50 AM To: CF-Talk Subject: Re: can't get onApplicationStart to fire... No, but then why should i? If the methods were getting called then the ?.started variables would be getting set, but only request.started is getting set. Bert On Fri, 11 Feb 2005 06:32:53 -0500, Calvin Ward <[EMAIL PROTECTED]> wrote: > Are you restarting CF before you request index.cfm? > > -Original Message- > From: Bert Dawson [mailto:[EMAIL PROTECTED] > Sent: Friday, February 11, 2005 5:48 AM > To: CF-Talk > Subject: can't get onApplicationStart to fire... > > I can't seem to get onApplicationStart to run, nor onSessionStart, but > on request start works fine. I'd be grateful if someone could caste an > eye over my code to see if they can spot what i'm doing wrong: > 2 files in a directory: Application.cfc and index.cfm: > -- > Application.cfc: > > > > > > > > > > > > > > > > > > -- > index.cfm: > clientmanagement="No" > sessionmanagement="Yes" > setclientcookies="No"> > > > > > > > -- > > When i run index.cfm only request.started has been set (plus > application.name, session.jsessionid and session.urltoken, and > request.cfdumpinited). > TIA > Bert > > ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:194215 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
Re: can't get onApplicationStart to fire...
No, but then why should i? If the methods were getting called then the ?.started variables would be getting set, but only request.started is getting set. Bert On Fri, 11 Feb 2005 06:32:53 -0500, Calvin Ward <[EMAIL PROTECTED]> wrote: > Are you restarting CF before you request index.cfm? > > -Original Message- > From: Bert Dawson [mailto:[EMAIL PROTECTED] > Sent: Friday, February 11, 2005 5:48 AM > To: CF-Talk > Subject: can't get onApplicationStart to fire... > > I can't seem to get onApplicationStart to run, nor onSessionStart, but > on request start works fine. I'd be grateful if someone could caste an > eye over my code to see if they can spot what i'm doing wrong: > 2 files in a directory: Application.cfc and index.cfm: > -- > Application.cfc: > > > > > > > > > > > > > > > > > > -- > index.cfm: > clientmanagement="No" > sessionmanagement="Yes" > setclientcookies="No"> > > > > > > > -- > > When i run index.cfm only request.started has been set (plus > application.name, session.jsessionid and session.urltoken, and > request.cfdumpinited). > TIA > Bert > > ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:194214 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
RE: can't get onApplicationStart to fire...
Are you restarting CF before you request index.cfm? -Original Message- From: Bert Dawson [mailto:[EMAIL PROTECTED] Sent: Friday, February 11, 2005 5:48 AM To: CF-Talk Subject: can't get onApplicationStart to fire... I can't seem to get onApplicationStart to run, nor onSessionStart, but on request start works fine. I'd be grateful if someone could caste an eye over my code to see if they can spot what i'm doing wrong: 2 files in a directory: Application.cfc and index.cfm: -- Application.cfc: -- index.cfm: -- When i run index.cfm only request.started has been set (plus application.name, session.jsessionid and session.urltoken, and request.cfdumpinited). TIA Bert ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:194210 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
can't get onApplicationStart to fire...
I can't seem to get onApplicationStart to run, nor onSessionStart, but on request start works fine. I'd be grateful if someone could caste an eye over my code to see if they can spot what i'm doing wrong: 2 files in a directory: Application.cfc and index.cfm: -- Application.cfc: -- index.cfm: -- When i run index.cfm only request.started has been set (plus application.name, session.jsessionid and session.urltoken, and request.cfdumpinited). TIA Bert ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:194206 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54