A Gotcha: Adobe ColdFusion 10, Apache Tomcat, J2EE Sessions

I’ve spent a bit of time over the past month or so playing with setting up a couple of my development systems to run both Railo and Adobe ColdFusion 10 concurrently on a stock install of Apache Tomcat 7. In the case of ACF10, my interest in running on stock Tomcat is based on a desire get away from the custom-built and now out-dated version of Tomcat which Adobe (unwisely, in my opinion) bundles with ACF10. This past week I bumped into a bit of a gotcha that took me quite a bit of time to track down and solve. In the hopes of helping others avoid this same problem and so that I don’t forget it, I’ll share what I ran into and how to solve it.

The symptoms I was seeing were that as soon as I enabled J2EE sessions in the CF administrator and then subsequently stopped Tomcat for any reason, Tomcat would no longer start cleanly, it was no longer bringing up the context running ACF, and because it was not starting cleanly it would also not shutdown cleanly. As weird as this seemed (and sounds, I realize), this was very repeatable. I had it down to something I could reproduce in under 5 minutes: set up a clean new Tomcat install, deploy ACF10 on it via a WAR file, sign into the CF admin, enable J2EE sessions, stop Tomcat… and it would no longer start. There was nothing in the ${CATALINA_BASE}/logs/catalina.out log file indicating what was wrong; it just looked like Tomcat would hang as it was starting. I determined I could install, deploy, and then start/stop Tomcat successfully as many times as I wanted and the problem would not show up until and unless I enabled J2EE sessions in the CF admin. It did not seem to be dependent on whether ACF10 was patched or the specific version of Tomcat.

At one point, I even dug around and figured out how to change the log level used by Catalina, in the hopes that a bit more detail might shed some light on the problem but the bump of one additional level of detail took the log entries on starting Tomcat from under 40 to over 15,000… and while the nature of the problem — in retrospect, of course — might well have been touched on in that blizzard of log entries, I couldn’t find anything even remotely resembling a needle in that sea of haystacks.

It seemed like something specifically related to turning on J2EE sessions in ACF10 was breaking Tomcat. Based on a suggestion from a co-worker, I removed write permissions for the user under which Tomcat was running from all folders under ${CATALINA_BASE} except the ./logs/ and ./webapps/ folders, in an attempt to see if I could determine where the breakage was occurring. On starting Tomcat, I noticed a complaint in the ${CATALINA_BASE}/logs/catalina.out log file about not being able to write to folder ${CATALINA_BASE}/work/Catalina/localhost/_. Looking in that folder, I found a file named SESSIONS.ser. Doing a bit of Googling, I came across a short blog post dealing with session persistence across Tomcat restarts.

I’m not going to pretend that I know why Tomcat would have session persistence enabled across restarts, or why I might want to persist sessions across restarts (I really can’t come up with a scenario where I would want that), or why enabling J2EE sessions in ACF10 would seem to break this persistence… but clearly it does. That file gets written on stopping Tomcat and is then read and removed when Tomcat next starts/restarts. To disable this persistence, the context(s) within Tomcat on which ACF10 is enabled need to include a Tomcat session manager component specifically configured to disable this persistence:

...
<Manager pathname="" />
...

This is touched upon in the Apache Tomcat docs here. That session manager component can occur in any of the supported locations where contexts are configured in Tomcat. Once I confirmed this to solve the problem, I took a quick peek at the context configuration for ACF10 when it is running against the Adobe-provided custom build of Tomcat 7.0.23, and — sure enough — it disables session persistence in precisely this same manner.

The one upside to all of the time I spent tracking this down is that I can now install Tomcat and deploy ACF on it in a matter of just a few minutes in a variety of ways, including multiple virtual hosts under a single Tomcat, multiple Tomcat installs running on different ports, and  a single Tomcat install with multiple instances via use of ${CATALINA_HOME} and ${CATALINA_BASE}. I’m kicking myself for not looking at deploying ACF on stock Tomcat three years ago when I learned of Adobe’s choice with ACF10 to use a non-stock Tomcat that they inexplicably have not updated.

Hey, that’s me!

ActiveState recently stood up a new Web site specifically for Komodo IDE/Edit (which I find encouraging, as I have long felt that it wasn’t featured prominently enough of the ActiveState site) and have been tweeting quite a bit about Komodo the past few weeks (also encouraging). As part of that effort that seems focused on raising the visibility of what I have long felt to be a tremendously powerful general-purpose code IDE/Editor that isn’t horribly bloated and sluggish (yup, that’s looking at you Eclipse!), the Komodo team kicked off a promotion to give away a couple of licenses based on submitting a screenshot of your Komodo set-up.

So I did. And I won…

I am grateful for the license (and their comments about my entry). As a long-time user of Komodo (I use Edit at home, and IDE at work), I have always been impressed by both the product and the quality and level of support provided by the people behind it. And I am glad to see that ActiveState is taking an active role to raise its visibility — that seems to me to bode well for its future.

With some of the recent/upcoming changes to the CFML language from both the Railo and Adobe ColdFusion product updates, I’ll be digging back into my Komodo-CFML language extension for some updates in the coming weeks.

Time for a talk

Li turned 7 years old this past Monday, and based on something I saw Friday afternoon, it would seem that the time has come for one of those important father/daughter “talks”. I was doing some volunteer computer tech support at Li’s school on Friday afternoon. She had left her research paper on Argentinean pampas deer open in MS Word on one of the computers in her classroom. (She had saved it — of which I was proud — something not all of the students in her class have apparently learned, based on my observations.) One of her teachers found me sobbing uncontrollably under the computer table… Li’s entire paper is set in … [gasp] Comic Sans. The horror, the shame… I was so unprepared.

While MS Word probably does not deserve anything better, Comic Sans is a horrible thing to do to Argentina, pampas deer, and research papers. Yes, even 1st grade research papers.

(This entry is based on a Facebook post I started on January 10, 2014. Most of it is true, aside from the “sobbing uncontrollably under the computer table” bit.)

Holiday Traditions

This post comes out of a recent conversation with friends over coffee, in which we were talking about our respective families’ traditions for the Christmas season and where those traditions came from.

  • Food: we cook much more frequently over the Christmas break than during the rest of the year, where by “cook” I mean really cook (as in make stuff that takes more time than we would normally have during a typical day). A big part of this is tied to work schedules: the lab where I work shuts down between Christmas and New Year’s Day each year and I usually bracket that with additional personal leave to stretch it even longer. This is something we’ve just sort of grown into over the past 10 years or so.
  • The Christmas tree: usually up around mid-December (these days tied to Ian’s arrival home from school) and down on the 1st or 2nd of January. My least favorite tradition, truth be told.
  • Christmas music: we almost always have some sort of Christmas or holiday-ish music playing during this same period, with “The Andy Williams Christmas Album” occupying a special place in the play list as the most important. I remember listening to this each year as a kid, and at some point we ended up with it on CD. Cheesy, but still my favorite Christmas album (probably as much for the memories as for the actual music).
  • Baking Christmas goodies: my fudge, Ian’s peppermint strips, sugar cookies (most decorated, of course), Deb’s pecan fingers, holiday breads. Some to eat, lots to share and give as gifts. This is something both Deb’s and my families did as we were growing up.
  • Clam chowder and candlelight church on Christmas Eve: the clam chowder part is from my family; we both grew up going to church on Christmas eve.
  • Hot chocolate and cookies before bed on Christmas Eve: something my family always did after coming home from church.
  • Cinnamon rolls on Christmas morning: this is something my mom did some years as I was growing up, and I love getting up early on Christmas morning and making them for my family.
  • Christmas stockings before breakfast on Christmas morning, opening gifts after breakfast: definitely from my family, rather than Deb’s. Stockings were always one of my favorite parts of Christmas growing up, and still are. The challenge at this point is convincing Li to let Ian sleep until something he would consider a “reasonable” hour (maybe a little after 8:00 am, these days).
  • The bibliophilic elf: each year, each of us gets a book from a certain literature-loving elf, something we started about 10 years ago. This tradition is one of our own.
  • Jigsaw puzzles: more from Deb and Deb’s family than mine. Deb always gets a puzzle started and everyone helps, whether it is looking for a piece or two as they walk by, or pulling up a chair and sitting down for an extended period of time to work on it. There is almost always a puzzle or two under the tree for all of us each year, and we often work through half a dozen or more before the puzzle table gets put away.

We also tend to play lots of board and card games, and we tend to stay up late watching movies (or, the past couple years, binge-watching something Ian has found like “Firefly” or “Battlestar Galactica”), but I’m not sure those have yet reached what I would consider full tradition status. We also almost always spend a few days with my parents and with Deb’s parents somewhere during time around Christmas, either here or at their respective homes; again, part of our typical Christmas Season but not necessarily what I would call tradition.

 I’ve thought about some of these things this Christmas, given a conversation with Deb back in mid-December when we were talking about Christmas. There is actually quite a bit about “Christmas” I really don’t like: the busyness, shopping, unwanted obligations or things we do just because we feel like we ought to or are expected to (we all have them, right?), dicey travel conditions, the clutter, the overly-commercial aspect that Christmas has taken on. The parts I really like are the time spent together as a family (all of us home from work and school) and the food (the eating but even more so the preparation together). Some of that almost certainly comes through in looking at what we’ve turned into our family traditions.

Here we go…

All of these are combining — as they typically do each year — to pile on a good case of the January blues:

  • Li’s birthday is tomorrow. She turns 7. How is this even remotely possible? I can’t believe how fast this past year and, really, all of her life have raced past.
  • Ian heads back to Norman tomorrow morning for the upcoming start of the spring semester of his fourth year of college. Has he really been home for three weeks already? It’s never been easy on any of us when he leaves but the past couple departures have really been hard; this one will be, too.
  • Li goes back to school tomorrow. She’s really excited about this and about her birthday, but also really struggling with Ian’s impending departure. Yesterday was not a good day for her, and the internal tension between her excitement and her sadness was a big part of it.
  • I go back to work on Tuesday (the day after tomorrow), after having been off work for a full three weeks.