Full Client variables causes startup errors

For clustering reasons, we are switching all of our session variables
to use client storage. I have set up the Coldbox config to use client
storage for "flashURLPersistScope" and i18n uses "localeStorage".
After applying this change and restarting the CF service I now get an
error about the CLIENT scope not being initialized inside of the i18n
plugin. I have turned on clientManagement and it has been working
until we shifted everything in Coldbox to client storage, too. We are
using Adobe CF 9.0.1 and Coldbox 3.1.0. Here is the error:

The requested scope CLIENT has not been enabled.

Before CLIENT variables can be used, the CLIENT state management
system must be enabled using the cfapplication tag.

The error occurred in C:\inetpub\wwwroot\coldbox\system\plugins
\i18n.cfc: line 162
Called from C:\inetpub\wwwroot\coldbox\system\plugins\i18n.cfc: line
Called from C:\inetpub\wwwroot\coldbox\system\web\services
\LoaderService.cfc: line 129
Called from C:\inetpub\wwwroot\coldbox\system\web\services
\LoaderService.cfc: line 96
Called from C:\inetpub\wwwroot\coldbox\system\Coldbox.cfc: line 71
Called from C:\website\Application.cfc: line 51
160 : <cfset session.DefaultLocale = arguments.locale>
161 : <cfelseif instance.localeStorage eq "client">
162 : <cfset client.DefaultLocale = arguments.locale>
163 : <cfelse>
164 : <cfset cookie["DefaultLocale"] = arguments.locale>

What function is line 51 within for you application.cfc? Sometimes, settings may not be applied within the body of the application.cfc.

Line 51 is the standard loadColdBox(); which is inside of

My thinking is that CF doesn't initialize the client scope until after
the onApplicationStart(). If that is the case, how do I use it as a
storage source for i18n?

If your assumption is right, you could setup an application flag to see if you’ve executed “loadColdbox()” yet, and move that function call into your onRequestStart() method. A simple solution, but, I’ve not dug into the issue to know if it will solve your problem.

Should only take a moment to test.

Just execute some page with “applicationStop();” and then you can make your changes and see if it works on the next call to your site.

Aaron Greenlee

Yes, that seems to have fixed it. I moved the execution of
loadColdbox() into the onRequestStart(), but it only runs of the
application is missing the cbcontroller object. I've tested it with
resetting and reloading the framework. Seems to be working and has
fixed the problem.

I guess that proves that the client scope is not prepared until after
the onApplicationStart(), at least with CF 9.0.1.