Session Is Invalid Error

A bug I first got this error a few weeks back, and when it showed up again this week, I thought I should look into it and see how this could be happening, and I thought that I'd post the results here so that it might aid the next person trying to stitch together the details.

The first thing you'll probably stumble across when googling for this issue is Session Is Invalid Bug (and Fix) by Ray Camden, which points you to this post by Brandon Purcell that that then points you to this Tech Note from Adobe that explains that this happens when you are running J2EE session values and your J2EE session times out before your ColdFusion session times out. This really makes a lot of sense even if the ntoes are out of date (CF 6), but the story's not quite so simple.

The Problem

My application already has a timeout of 20 minutes, so the 30 minute J2EE window shouldn't be a problem. A little more googling brought me this post on Just Skins by bert.d that says he was still getting error messages with a CF timeout less than that of the J2EE timeout. That sounds a lot like my problem, so more googling, since this didn't provide an answer. I finally found more info at Nabble where a user said to check not only your application's timeout, but your CF Server setting for the maximum session timeout. Sure enough, this was still set to 2 hours on my server, so I cranked it down to 21 minutes, and I hope that resolves this issue.

The Solution

If you are having problems with "Session is Invalid" errors, your J2EE sessions are timing out before your CF sessions are timing out. You have two options: extend the J2EE sessions as described in the Tech Note, or tighten your CF session timeouts in the CF Administrator. It doesn't appear to matter what your application timeouts are set for in this case.



Mickey's Gravatar the problem is with J2EE sessions ...disable it and will work fine.
Jim's Gravatar I use shared hosting where they will not change the max session. How else can I fix the issue, this is exactly the problem I have?! Thanks for the help!
Tom's Gravatar This is nothing to do with J2EE sessions. We have them disabled, and still the error persists.
Jon Hartmann, July 2011

I'm Jon Hartmann and I'm a Javascript fanatic, UX/UI evangelist and former ColdFusion master. I blog about mysterious error messages, user interface design questions, and all things baffling and irksome about programming for the web.

Learn more about me.

Post a job. Find one.

Interested in becoming a sponsor? Contact me.