So, the title pretty much says it all: I'm switching from a single-server ColdFusion install to a multi-server ColdFusion install, and session replication does not work if I set the application name.
Here's a stripped-down application.cfc that does NOT replicate sessions successfully.
component
{
this.name = 'myTestApp';
this.sessionManagement = true;
this.sessionTimeout = createTimeSpan(0,2,0,0);
}
As soon as I comment out the application name, session replication works perfectly between my servers.
I believe this Adobe help page tangentially references the issue:
If you do not specify an application name in the This.name variable in the Application.cfc initialization code or by using the ColdFusion cfapplication tag, the application is unnamed, and the Application scope corresponds to the ColdFusion J2EE servlet context. ColdFusion, therefore, supports only a single unnamed application.
If multiple cfapplication tags and Application.cfc files do not specify an application name, all pages in these applications share the servlet context as their Application scope. All sessions of unnamed applications correspond directly to the session object of the J2EE application server. (If you do not use J2EE session variables, ColdFusion ensures that the J2EE session lasts at least as long as the session time-out.)"
It's obviously not regarded as a best practice to stop using application.name
. But how do I enable my servers to make sessions available when using named applications? Is there a way to register the application name in the J2EE/JRun servlet context? I'd hate to set up a separate instance cluster for every CF application we're running on the server; that hardly seems like an scaleable solution.
I feel like I'm probably missing something drastically simple here, not being a java guru, but any tips are appreciated.--Will