While doing some work on a project that is currently running on cfmx, but which I'm testing on cf8, this strange error message appeared:
coldfusion.compiler.ASTsimpleVariableReference cannot be cast to java.lang.String
If you get this message, it's basically telling you that somewhere you've passed a variable or object where a string was expected. In my case, it was with a code bug that the previous versions of cf worked with but probably should have thrown an error. What I found was an indexed loop tag with a variable being used for the index. If you think about it, that really doesn't make sense. I don't think the author meant that the actual variable name would change as the loop executed or that it needed to change based on some value passed in.
BAD
<cfloop from="1" to="#upperLimit#" index="#myIndex#">
Good
<cfloop from="1" to="#upperLimit#" index="myIndex">
What lead me to look at the loop was the stack trace that came along with the error. I don't know if anything else will cause this error, but the variable for an index string will cause it every time.
Musings on ColdFusion, Flex, Flash and other Adobe stuff
Wednesday, June 13, 2007
Obscure cf8 error message
Subscribe to:
Post Comments (Atom)
6 comments:
I am getting the same error on this code:
cfset myobj = CreateObject("Component", "Resources")
Any ideas why?
p.s.: i have removed the angle brackets just to make sure blogger.com accepts my text.
I think the code you posted looks ok, so I guess the next step is to dig into the component itself. Look for some place where you've passed a complex object to something expecting a simple string.
Thanks for blogging this Mike
It's probably obvious to note that if you are dealing with included files that the actual syntax error can often be contained within any files included by your script, not necessarily at the point where the compiler gives the error.
Had me banjaxed for a while!
Thanks Mike, this one really stummpped me. Like Dom it was deep in an included file so took some finding.
Ha thanks, I can't believe I didn't notice myself!
THANKS! I went right to the problem in the code after finding your post on the matter. Danke.
Post a Comment