Lucee Error: Can't cast Complex Object Type Struct to String

Skip to first unread message

Michael Vornkahl

Apr 26, 2016, 3:33:02 AM4/26/16
to Lucee
Hi everybody,
I have a very simple code, which creates an array with one value and then add a column to an existing query and fills it with this value:
        <cfset TestUserArray[1] = -1>
        <cfset temp=QueryAddcolumn(CheckUser,"Map_No",TestUserArray)>
This worked since the last versions, but after the last update, I get the following error-message:

Lucee Error (expression)
Message Can't cast Complex Object Type Struct to String
Detail Use Built-In-Function "serialize(Struct):String" to create a String from Struct
Stacktrace The Error Occurred in
D:\Inetpub\wwwroot\AbbVie-Portal\GER1304\visite1a.cfm: line 289
287: </cfquery>
288: <cfset TestUserArray[1] = -1>
289: <cfset temp=QueryAddcolumn(CheckUser,"Map_No",TestUserArray)>
290: <cfset TestUserArray[1] = "">
291: <cfset temp=QueryAddcolumn(CheckUser,"Title",TestUserArray)>

Java Stacktrace Can't cast Complex Object Type Struct to String
  at lucee.runtime.type.util.StructSupport.castToString(
  at lucee.runtime.op.Caster.toString(
  at abbvie_portal315.ger1304.visite1a_cfm$\Inetpub\wwwroot\AbbVie-Portal\GER1304\visite1a.cfm:289):289
  at lucee.runtime.PageContextImpl.doInclude(
  at lucee.runtime.listener.ClassicAppListener._onRequest(
  at lucee.runtime.listener.MixedAppListener.onRequest(
  at lucee.runtime.PageContextImpl.execute(
  at lucee.runtime.PageContextImpl.execute(
  at lucee.runtime.engine.CFMLEngineImpl.serviceCFML(
  at lucee.loader.servlet.CFMLServlet.service(Unknown Source):-1
  at javax.servlet.http.HttpServlet.service(
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(
  at org.apache.catalina.core.StandardWrapperValve.invoke(
  at org.apache.catalina.core.StandardContextValve.invoke(
  at org.apache.catalina.authenticator.AuthenticatorBase.invoke(
  at org.apache.catalina.core.StandardHostValve.invoke(
  at org.apache.catalina.valves.ErrorReportValve.invoke(
  at org.apache.catalina.core.StandardEngineValve.invoke(
  at org.apache.catalina.connector.CoyoteAdapter.service(
  at org.apache.coyote.ajp.AjpProcessor.process(
  at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(
  at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source):-1
  at java.util.concurrent.ThreadPoolExecutor$ Source):-1
  at Source):-1

Does anyone have a tipp for me?
Thank you

Gert Franz

Apr 26, 2016, 3:43:38 AM4/26/16
Hello Michael,

Normally this shouldn't have worked in any version. The line 

TestUserArray[1] = -1;

Creates the variable TestUserArray as a struct and not as an array, unless you would have something like

TestUserArray = []; 

In your code.

Sent from somewhere on the road
Love Lucee? Become a supporter and be part of the Lucee project today! -
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
To view this discussion on the web visit
For more options, visit

Zac Spitzer

Apr 26, 2016, 3:58:46 AM4/26/16
I filed a bug about this a while back

For more options, visit

Zac Spitzer
+61 405 847 168

Michael Vornkahl

Apr 26, 2016, 7:39:36 AM4/26/16
to Lucee
@Gert: Sorry,
I forgot to paste the line before the two statements:

        <cfset TestUserArray = ArrayNew(1)>

        <cfset TestUserArray[1] = -1>
        <cfset temp=QueryAddcolumn(CheckUser,"Map_No",TestUserArray)>
I think, that this should work. (It did work up to version
Now under it didn't work anymore.

Greetings MV

Michael Vornkahl

Apr 26, 2016, 7:52:55 AM4/26/16
to Lucee
Sorry again!!!!
I found it, somebody (I assume it was my left hand :-) ) deleted the line '<cfset TestUserArray = ArrayNew(1)>' in this file where the error occurs.
I added it and now everything works fine.

Sorry again for the trouble

Reply all
Reply to author
0 new messages