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

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

New Here ,
Apr 06, 2021 Apr 06, 2021

Copy link to clipboard

Copied

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. 
ErrorCase.png
I fixed the query:
SuccessCase.png
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?

Views

804

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 ,
Apr 06, 2021 Apr 06, 2021

Copy link to clipboard

Copied

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)

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
New Here ,
Apr 07, 2021 Apr 07, 2021

Copy link to clipboard

Copied

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).

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
Community Expert ,
Apr 08, 2021 Apr 08, 2021

Copy link to clipboard

Copied

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

 

In the meantime, try something like

SELECT *
FROM #this.EnvStruct.Items#

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
New Here ,
Aug 18, 2022 Aug 18, 2022

Copy link to clipboard

Copied

Sergey and Charlie, I have similar issue in CF2021:

class coldfusion.runtime.ApplicationScope cannot be cast to class coldfusion.runtime.Struct (coldfusion.runtime.ApplicationScope and coldfusion.runtime.Struct are in unnamed module of loader coldfusion.bootstrap.BootstrapClassLoader @1ddc6db2)

Also code analyzer show error of system function CreateObject.We are not using "corba" our script: 

<cfset request.Initialize =  createObject("component","initialize")>

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
Community Expert ,
Sep 17, 2022 Sep 17, 2022

Copy link to clipboard

Copied

LATEST

@albert3162 ,

The error you have shown ("class coldfusion.runtime.ApplicationScope cannot be cast to class coldfusion.runtime.Struct") is incompatible with the code

<cfset request.Initialize =  createObject("component","initialize")>

Is there a file named initialize.cfc in the current directory? 

 

 

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