Skip to main content
carmenj8315827
Participant
January 11, 2021
Question

QoQ on CF 2021 Enterprise errors

  • January 11, 2021
  • 1 reply
  • 276 views

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!

 

    This topic has been closed for replies.

    1 reply

    BKBK
    Community Expert
    Community Expert
    January 12, 2021

    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.