Skip to main content
Participant
April 6, 2021
Question

ColdFusion 2021 - class coldfusion.runtime.TemplateProxy cannot be cast to class

  • April 6, 2021
  • 1 reply
  • 1260 views
I installed ColdFusion 2021 and now I catch some error:
class coldfusion.runtime.TemplateProxy cannot be cast to class coldfusion.runtime.Struct (coldfusion.runtime.TemplateProxy and coldfusion.runtime.Struct are in unnamed module of loader coldfusion.bootstrap.BootstrapClassLoader @3b2553d9)
I investigated the issue and found that we can't use Structure this.EnvStruct.Items directly in the query. 
I fixed the query:
But It's not a good idea, because we have a lot of functions when we use the structure, this code is working in Coldfusion11 and Coldfusion2018.  Could you help me?
    This topic has been closed for replies.

    1 reply

    Charlie Arehart
    Community Expert
    Community Expert
    April 6, 2021

    Sergey, as a sanity check, can you simply do a cfdump before the cfquery of the 3 things: this.EnvStruct.Items, this.EnvStruct, and this (in that order), to confirm that what is in them is indeed what you expect?  Of course, what matters most is the first, but doing the others after it may be insightful. 

     

    Note that depending on other code we can't see, you may need to do more to be able to SEE that cfdump. Let's wait to hear back before proposing solutions to that. (At a minimum, it may help to do a cfabort right before the cfquery, to prevent its error from happening.)

    /Charlie (troubleshooter, carehart. org)
    Participant
    April 7, 2021

    Charlie, I saved a dump for 3 objects in files and they have valid structure. I see the error: class coldfusion.runtime.TemplateProxy cannot be cast to class coldfusion.runtime.Struct (coldfusion.runtime.TemplateProxy and coldfusion.runtime.Struct are in unnamed module of loader coldfusion.bootstrap.BootstrapClassLoader @609e57da).

    BKBK
    Community Expert
    Community Expert
    April 8, 2021

    @Sergey5C5F , please report a query-of-query bug.

     

    In the meantime, try something like

    SELECT *
    FROM #this.EnvStruct.Items#