• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

QoQ on CF 2021 Enterprise errors

Community Beginner ,
Jan 11, 2021 Jan 11, 2021

Copy link to clipboard

Copied

We just installed CF 2021 Enteprise on our Dev server (Win Server 2019) last week.

<cfquery name="qUserGroups" dbtype="query">
SELECT groupName FROM request.store.groups
WHERE groupID IN (#qUsers.userGroupList#)
</cfquery>

Whenever a Query of Query gets a shared scope variable, this error occurs:

"Error casting an object of type class coldfusion.runtime.RequestScope cannot be cast to class coldfusion.runtime.Struct (coldfusion.runtime.RequestScope and coldfusion.runtime.Struct are in unnamed module of loader coldfusion.bootstrap.BootstrapClassLoader @69909c14) to an incompatible type. This usually indicates a programming error in Java, although it could also mean you have tried to use a foreign object in a different way than it was designed."

 

I have also tried setting the value to a local variable or even the application scope, but the error is the same. Help!

 

Views

177

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 12, 2021 Jan 12, 2021

Copy link to clipboard

Copied

LATEST

The Request scope is meant to be used in this way: request.variableName. The problem you're facing is that you are using the shared scope, Request, as if it is a custom struct. That is, request.key1.key2.

 

That might work on certain occasions, as ColdFusion is weakly typed, but could fail in others. When ColdFusion evaluates request.key1.key2, it assumes Request is a struct or attempts to cast it into a struct. The result is a casting error.

 

To correct this, simply rename the query to request.store_groups.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation