Upgrading From ColdBox 2.0.x to 2.5.1
Posted on December 21, 2007 at 7:45 PM in ColdBox, ColdFusion
If you have not yet taken a look at the latest ColdBox release, 2.5.1, I really recommend that you do. It is an especially exciting release for me personally, as it now permits each of the following:
1. external event handlers
2. "flash" memory on setNextEvent() / setNextRoute()
3. internal support for Adam Fortuna's ColdCourse project
There are, however, a couple of "gotchas" that I wanted to pass along.
Gotcha #1
I don't know about you, but the last time I looked at an index.cfm file in a ColdBox application was, I don't know, probably two years ago. Simply put, there's nothing in those files, except the call to the framework, so there's no need to look at them. Or so I thought.
The upgrade guide clearly states that you need to use the new Application.cfc and index.cfm files with the 2.5.x Application Template, but for some reason I totally overlooked the "index.cfm" part. After all, there's nothing in that file.
So, I updated my Application.cfc file to extend the new coldbox.cfc file, and loaded the app. Only problem was, everything was now running twice. Thanks to Russ Johnson and Luis, I realized that I was an ID10T. Of course everything was running twice; I was calling the framework twice! Once in the Application.cfc, and again in the index.cfm file that I hadn't bothered to open and/or replace.
Gotcha #2
In the config.xml files for my old 2.0.x applications I have SessionStartHandler set to "main.onSessionStart", and the SessionEndHandler set to "main.onSessionEnd". Nothing out of the ordinary there, I know. What I didn't realize is that these particular methods don't actually exist in those handlers. I had just left them assigned so that should I in the future decide that I needed them, they were already set.
That's all fine and dandy in pre-2.5 applications. However, with 2.5, right after a ColdFusion service restart, I would receive a "method not found" exception on the first load, but on any subsequent loads the exception was not thrown.
It took me quite some time to figure out what was causing this issue, but it was the fact that I had named the events in the coldbox.xml, but they in fact did not exist in the handler.
Summary
Be sure to A) update your Application.cfc to extend the coldbox.cfc, B) either replace the index.cfm file with the new one from the template, or, if you have non-ColdBox code in your index.cfm file that needs to stay put, be sure to comment out the call to the framework, and C) make sure that your onSessionStart/End methods actually exist (even if they are empty).
Latest Articles
- No recent entries.
Categories
- ColdBox (21) [RSS]
- ColdFusion (92) [RSS]
- Fusebox (3) [RSS]
- General (22) [RSS]
- jQuery (15) [RSS]
- Kalendar (1) [RSS]
- Linux (1) [RSS]
- Mura CMS (1) [RSS]
- Railo (1) [RSS]
- Rants (5) [RSS]
- Transfer (8) [RSS]
- Uni-Form Tag Library (36) [RSS]
Quick Links
Blogs I Read
Calendar
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
« Sep | ||||||
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
Subscribe
Enter a valid email address.
There are no comments for this entry.
[Add Comment]