Reputation: 3558
I have just installed ColdFusion 11 Developer Edition on my computer to have my LocalHost environment match our recently-upgraded development and production environments.
But now, the same code that works everywhere else is failing on the new installation -- specifically:
This error also occurred when our server administrator performed the upgrade from ColdFusion 9 to 11 in December, so I reached out to him to find out how he resolved it. A significant difference, though, is that he was installing on a Linux box, using an Apache web server, and I am installing on a Windows 7 computer using the ColdFusion 11 Developer Edition's built-in web server.
In any event, he told me that he had made two changes to resolve this error on his system:
global.conf
file, add the following lines:RewriteEngine on
RewriteRule .* - [E=REMOTE_USER:%{REMOTE_USER}]
RewriteRule .* - [E=SCRIPT_NAME:%{REQUEST_URI}]
RewriteRule .* - [E=AUTHENTICATE_CN:%{ENV:AUTHENTICATE_CN}]
RewriteRule .* - [E=AUTHENTICATE_DEPARTMENTNUMBER:%{ENV:AUTHENTICATE_DEPARTMENTNUMBER}]
RewriteRule .* - [E=AUTHENTICATE_GIVENNAME:%{ENV:AUTHENTICATE_GIVENNAME}]
RewriteRule .* - [E=AUTHENTICATE_MAILALTERNATEADDRESS:%{ENV:AUTHENTICATE_MAILALTERNATEADDRESS}]
RewriteRule .* - [E=AUTHENTICATE_MAIL:%{ENV:AUTHENTICATE_MAIL}]
RewriteRule .* - [E=AUTHENTICATE_ORGANIZATIONALSTATUS:%{ENV:AUTHENTICATE_ORGANIZATIONALSTATUS}]
RewriteRule .* - [E=AUTHENTICATE_SERIALNUMBER:%{ENV:AUTHENTICATE_SERIALNUMBER}]
RewriteRule .* - [E=AUTHENTICATE_SN:%{ENV:AUTHENTICATE_SN}]
RewriteRule .* - [E=AUTHENTICATE_TELEPHONENUMBER:%{ENV:AUTHENTICATE_TELEPHONENUMBER}]
RewriteRule .* - [E=AUTHENTICATE_UID:%{ENV:AUTHENTICATE_UID}]
global.conf
file anywhere in my installation.Application.cfc
A web search was not very productive, but did lead me to a very old instruction for ColdFusion 8. Based on that article, I tried adding the following lines to my Application.cfc
file -- but this did not resolve the error:
<cfset this.sessionManagement = "Yes" >
<cfset this.name = "ApplicationName" >
I searched for similar issues on Stack Overflow, but didn't find any promising leads. I found one similar question here, but that person seems to have a different problem than I'm experiencing: In his case, the SESSION
variable exists (as he can demonstrate with <cfdump>
, but is being ignored later in code. But in my case the SESSION
variable doesn't seem to have been created in the first place.
I did try one of the suggestions there, however: adding the following to onSessionStart()
:
SESSION.User = CreateObject("component", "cfc.User");
Unfortunately, this did not resolve the problem.
I suspect that the crux of the issue is my use of the built-in server, and that I must add lines to a configuration file somewhere like our server administrator did with the Apache global.conf
file.
Any ideas what I need to do to get my code working on this local ColdFusion 11 installation?
Ultimately, the cause of the problem was a configuration issue (compounded by a flawed program design):
In the OnApplicationStart()
function, there is a call to the database, which failed because I had neglected to install the appropriate JAR
file on this new installation. This sent program execution to the OnError()
function. In our case, the OnError()
function includes some information from the SESSION
variable in its report – but because program execution never finished the OnApplicationStart()
function, it consequently never entered the OnSessionStart()
function where the SESSION
variable is created. And this led to the "Variable SESSION is undefined" error.
I have upvoted Kris's answer and marked it correct. (Well-done for a new user, Kris!)
Upvotes: 4
Views: 2846
Reputation: 31
This can also happen if you accidentally set the timeout params for session vars in CFAdmin to 0. It won't be unlimited, it will make the session scope go away.
Upvotes: 0
Reputation: 76
Continue troubleshooting by determining if it's a problem with your install vs. your code. I would try creating a new site in Apache, using the CF server configuration tool, and then creating a new project in CFB. Create an Application.cfc file and index.cfm. In Application.cfc make sure you have this.sessionManagement = true
and this.clientManagement = true
. In index.cfm just cfdump
the session. If this results in success you can look further into your existing code. If it fails you might want to try reinstalling CF.
Upvotes: 6