Re: Cannot access session variables in a cfc

2015-01-29 Thread Scott Stewart
Some of the dangers to this approach include: the amount of memory allocated to the JVM. If you stuff alot of data into the Application scope, it persists in the JVM allocated memory and it's not available to the rest of the system/application. You really can't change data in the Application

Re: Cannot access session variables in a cfc

2015-01-29 Thread John Pullam
For what it's worth, the approach of storing a global data item in the application scope seems to be legit according to the documentation. Here's what it said in the CF10 doc: Application variables are a convenient place to store information that all pages of your application might need, no

Re: Cannot access session variables in a cfc

2015-01-29 Thread Scott Stewart
+1 On Thu, Jan 29, 2015 at 12:53 PM, Russ Michaels r...@michaels.me.uk wrote: I'll add for the sake of brevity, please don't put application wide cfcs in session scope, as a hosting provider I have seen this kill a server. 5000 users = 5000 instances of the cfc. In most cases using a

Re: Cannot access session variables in a cfc

2015-01-29 Thread Russ Michaels
I'll add for the sake of brevity, please don't put application wide cfcs in session scope, as a hosting provider I have seen this kill a server. 5000 users = 5000 instances of the cfc. In most cases using a mapping solves the issues you have with cf not finding the cfc. On Thu, Jan 29, 2015 at

RE: Cannot access session variables in a cfc

2015-01-28 Thread Robert Harrison
Were you using relative paths to the CFCs. That could become hairy if you move things around. I'll generally define a CFC path variable in the application.cfm then use that everywhere. Never had a problem. Of course, this assumes all the CFC's are in the same location. Robert Harrison Full

RE: Cannot access session variables in a cfc

2015-01-28 Thread William Seiter
later when the fires are out. Thanks, William -- William Seiter -Original Message- From: John Pullam [mailto:jpul...@mcleansystems.com] Sent: Wednesday, January 28, 2015 8:57 AM To: cf-talk Subject: Re: Cannot access session variables in a cfc I know

Re: Cannot access session variables in a cfc

2015-01-28 Thread John Pullam
You will need to pass your session variables as a parameter in order to use them in the CFC, this is best practices anyways. The difficulty is that there a lot of cfc calls and some of them are in bind expressions so the chance of making errors is high. That's why I am so anxious to find one

Re: Cannot access session variables in a cfc

2015-01-28 Thread Byron Mann
On Wed, Jan 28, 2015 at 1:57 PM, Robert Harrison rharri...@aimg.com wrote: try adding an Application.cfc in the root physical directory I don't that that will work. It would still be a separate application pool, and I think you need the CFID and CFTOKEN cookies to have session vars.

Re: Cannot access session variables in a cfc

2015-01-28 Thread Byron Mann
@Dean, Looked into this a bit further on CF10. root - Application.cfc - ApplicationProxy.cfc (extends Application) - cfc-folder - - Application.cfc (extends ApplicationProxy) - - myCFC.cfc This does not work without the cfc/application.cfc having extends=root.ApplicationProxy, where 'root' is

Re: Cannot access session variables in a cfc

2015-01-28 Thread Dean Lawrence
Byron, the ApplicationProxy.cfc needs to be in the root directory along with the main Application.cfc. When you extend a CFC, CF will first look in the same directory to see if that CFC exist. If it doesn't CF will start looking for the CFC from the application root down. So by simply adding

Re: Cannot access session variables in a cfc

2015-01-28 Thread Dean Lawrence
Hmm, that's odd as I use that setup on numerous sites and I never have to map the applicationproxy. I am currently using it on both ACF 10 and 11, but I started using this around 8 or 9 and haven't changed it for new version. I don't believe that you could use the root.(dot) notation in 8 or 9,

Cannot access session variables in a cfc

2015-01-28 Thread John Pullam
My app is running in a CF10 system and since I moved my cfc's out of the document root, they are losing access to the session variables. It seems that they work for around a day and then can no longer be found. I initialize them in my application.cfm to a value and I can still cfdump them in a

RE: Cannot access session variables in a cfc

2015-01-28 Thread Robert Harrison
What other method than session variables can I use to pass a common variable that won't require me to include it as a parameter of every calling routine? Since you've moved your CFCs out of the application I cannot think of any other method beside passing them all as arguments. Robert

RE: Cannot access session variables in a cfc

2015-01-28 Thread Robert Harrison
If you moved your cfc's above the application.cfc (or application.cfm) file, the session variables will not be accessible. Session and application vars are accessible from the application file down. Robert Harrison Full Stack Developer AIMG rharri...@aimg.com Main Office: 704-321-1234  ext.118

Re: Cannot access session variables in a cfc

2015-01-28 Thread John Pullam
If you moved your cfc's above the application.cfc (or application.cfm) file, the session variables will not be accessible. Session and application vars are accessible from the application file down. That's what we did. What other method than session variables can I use to pass a common

Re: Cannot access session variables in a cfc

2015-01-28 Thread Steve 'Cutter' Blades
You shouldn't, as it breaks encapsulation. Any outside variables you would need inside a cfc should be passed into the cfc, either as part of your object initialization, or directly into a specific method. Cutter On 1/28/2015 10:25 AM, John Pullam wrote: If you moved your cfc's above the

Re: Cannot access session variables in a cfc

2015-01-28 Thread John Pullam
Thanx. That's what I think I will do for the time being. It is hard for me to come up with all the symptoms that we started seeing on the cfc's now and I don't think I could do justice to any explanation of those issues. It seemed to me that it was all quite normal stuff. All pages and cfc's

RE: Cannot access session variables in a cfc

2015-01-28 Thread Robert Harrison
You shouldn't, as it breaks encapsulation Honestly, I too think you should reconsider moving the CFC out of the web root. Maybe if you moved them out then created objects from them in the application.cfc, then you may be able to use session vars, as I think the objects would still be in the

RE: Cannot access session variables in a cfc

2015-01-28 Thread William Seiter
required=yes / Hope this helps, William -- William Seiter -Original Message- From: John Pullam [mailto:jpul...@mcleansystems.com] Sent: Wednesday, January 28, 2015 8:08 AM To: cf-talk Subject: Cannot access session variables in a cfc My app is running

Re: Cannot access session variables in a cfc

2015-01-28 Thread John Pullam
I know this isn't ideal, but it is a live application and the decision to move the cfc's outside of the doc root was taken because CF was having trouble finding them (for no obvious reason). Code that has worked since CF7 started breaking. So we moved them and this problem began. I am

RE: Cannot access session variables in a cfc

2015-01-28 Thread Robert Harrison
Well, I'd hate to do this, but you could define an application.myvar type variable and put all the variables you need to pass in that as a structure or list, then send that variable in your arguments. That would get to one variable ... but then you're still going to need to deconstruct it before

Re: Cannot access session variables in a cfc

2015-01-28 Thread Byron Mann
While I agree it isn't a good practice to make use of scope variables in a CFC, try adding an Application.cfc in the root physical directory of your CFCs and use the same application name and session and app timeouts. I think this would work in older versions, but not too sure about more recent

RE: Cannot access session variables in a cfc

2015-01-28 Thread Robert Harrison
try adding an Application.cfc in the root physical directory I don't that that will work. It would still be a separate application pool, and I think you need the CFID and CFTOKEN cookies to have session vars. Robert Harrison Full Stack Developer AIMG rharri...@aimg.com Main Office:

Re: Cannot access session variables in a cfc

2015-01-28 Thread Dean Lawrence
You could also extend the main application.cfc. You can't do this directly if the cfc's are in a sub-directory though. If that is the case, you could use a proxy, I do this all the time. Here would be the structure. root - Application.cfc - ApplicationProxy.cfc (extends Application) - cfc-folder

Re: Cannot access session variables in a cfc

2015-01-28 Thread Steve 'Cutter' Blades
John, There are some pretty significant advancements to CFCs since CF 7, especially around scoping. You definitely want to look at the difference up the version chain. Cutter On 1/28/2015 12:02 PM, John Pullam wrote: Thanx. That's what I think I will do for the time being. It is hard for