ColdFusion已设Cookie存储客户端变量却仍尝试写入注册表报错
First, let's anchor our discussion with the error you're encountering:
Mar 16, 2019 23:59:58 PM Information [ajp-bio-8013-exec-1] - Unable to set value HKEY_LOCAL_MACHINE\SOFTWARE\Macromedia\ColdFusion\CurrentVersion\Clients\6037671-54317b2e75ffe265-6210232F-5056-9D86-AFD90AADCC13ABBD[VARIABLE_NAME_HERE]: Windows error number 0 occurred.The handle is invalid.
Since you've already ruled out the global registry storage setting, let's break down the less obvious triggers:
1. Application-Level Storage Overrides
Your global ColdFusion settings might be set to cookie storage, but individual applications could be overriding this. Check:
- In
Application.cfc: Look forthis.clientStorage = "registry";(or any value other than"cookie"). Update it tothis.clientStorage = "cookie";to enforce cookie storage for that app. - In
Application.cfm: Verify the<cfapplication>tag doesn't haveclientstorage="registry"; replace it withclientstorage="cookie"if present. - In the ColdFusion Administrator: Navigate to Server Settings > Client Variables and confirm every variable group uses
Cookieas its storage type (notRegistry).
2. Stale Registry Data & Cached Client IDs
If you recently switched from registry to cookie storage, existing users might still have old CFID/CFTOKEN values in their cookies that point to leftover registry entries. Try these fixes:
- Restart your ColdFusion service to clear in-memory cached client IDs.
- Manually clean up old entries in
HKEY_LOCAL_MACHINE\SOFTWARE\Macromedia\ColdFusion\CurrentVersion\Clients(always back up the registry before making changes). - Implement a one-time logic to reset
CFID/CFTOKENfor returning users, or ask them to clear browser cookies to force new cookie-based sessions.
3. ColdFusion Service Account Permissions
Even with cookie storage enabled, the error can pop up if the ColdFusion service account lacks proper permissions to the registry path. This often happens after:
- A system update modified registry permissions for the Macromedia/ColdFusion directory.
- The service account (e.g., Local System, a custom domain account) was updated and lost read/write access.
To resolve:
- Open
regedit.exeand navigate toHKEY_LOCAL_MACHINE\SOFTWARE\Macromedia\ColdFusion\CurrentVersion\Clients. - Right-click the key, select Permissions, and ensure the ColdFusion service account has at least Read permissions (or Read/Write if you need to clean up old entries).
4. Configuration Cache or Version-Specific Bugs
Older ColdFusion versions (pre-2018) had known bugs where client storage settings weren't properly refreshed after changes. Try:
- Clear server caches in the ColdFusion Administrator: Go to Server Settings > Caching and click Clear Template Cache Now and Clear Component Cache Now.
- Check for available hotfixes for your ColdFusion version. For example, ColdFusion 2016 Update 5 fixed inconsistencies in client variable storage handling.
5. Custom Code or Third-Party Components
Double-check your application for direct registry access that might trigger this error:
- Look for
<cfregistry>tags interacting with theClientsregistry path. - Check Java code (via
<cfobject>or<cfscript>) that uses Windows API calls orjava.util.prefsto access the registry. - Verify third-party CFX components or plugins aren't accessing client data in the registry.
内容的提问来源于stack exchange,提问作者Phil

