Twitter: raymondcamden


Address: Lafayette, LA, USA

What the heck is Application ''?

04-25-2012 2,978 views ColdFusion 8 Comments

I'm working on an update to CFLib. Nothing that end users will actually see, but rather all behind the scenes. The current code base makes use of Model-Glue and Transfer. I'm rebuilding it for ColdFusion 10 and making use of Framework One and ORM. It's been a while since I've gotten to use FW/1 and I forgot how much of a pleasure it is to use.

I did run into one issue that threw me for a loop. Whenever I work with an ORM-based site, I know I'll need to call ormReload and applicationStop on demand, so I whip up code that looks like this.

Normally I put this within onRequestStart. However, in my FW/1 Application.cfc, I didn't have any of the methods I normally do. So I simply placed it as is within the file.

When I added ?init to my URL to force a refresh, I got this error:

Application '' does not exist.

I had absolutely no idea why this occurred since obviously my application did have a name. I filed a bug and after exchanging a few emails with Adobe engineer Sagar H Ganatra, he discovered the issue.

At the time my code ran, the application wasn't properly "ready" yet. When the code block is moved into onRequestStart, that's when you can run an applicationStop call properly.

We both agreed that the error message wasn't helpful, and the bug has been updated to correct the message and make it more clear what the issue is.

8 Comments

  • Commented on 04-25-2012 at 9:38 AM
    you do have to be careful what you put in the pseudo-constructor because as you discovered the application isn't available at that point.

    I ran into this issue when trying to pull my orm config from a file and then cache it, the only place thats available for you to cache things in the pseudo constructor is the server scope.

    would be nice if this area got a little bit of love from the devs
  • Nando #
    Commented on 04-25-2012 at 11:33 AM
    Ray,

    Here's what I use within FW/1 to reload the application:

    public function setupRequest() {
          if(structKeyExists(url, "init")) {
             ormReload();
             setupApplication();
             location(url="index.cfm",addToken=false);
          }
    }

    Works well for me.
  • Commented on 04-25-2012 at 8:46 PM
    Let me know if I can lend a hand.
  • Commented on 04-25-2012 at 8:54 PM
    With?
  • Commented on 04-25-2012 at 9:04 PM
    conversion of cflib
  • Commented on 04-25-2012 at 9:06 PM
    Well, gee, thats obvious. Sorry. Um - I appreciate the offer - but it's getting me some practice with FW/1 again. I'm not in a big rush also since this server won't be CF10 for a little while.

    That being said - if you want to help admin the content, you can.
  • Commented on 04-25-2012 at 9:56 PM
    FYI - if you ApplicationStop(), you don't need to ORMReload() :)
  • Commented on 04-26-2012 at 5:37 AM
    Interesting - I always used them both. Well, that will make things even simpler.

Post Reply

Please refrain from posting large blocks of code as a comment. Use Pastebin or Gists instead. Text wrapped in asterisks (*) will be bold and text wrapped in underscores (_) will be italicized.

Leave this field empty