Porting an application over from Adobe ColdFusion 9, getting an unusual Object type cast error

Hey all,

I’m porting an application over from Adobe ColdFusion 9. In the application
I have a web service call. In the CFC, I have this small bit of code that
calls the init method of the CFC in the event that the datasources don’t
exist in the variables scope of the CFC.
Here’s the calling code:

<cfif not StructKeyExists(variables, “dsn”)>


<cfset init(local.dsn, local.dodaacDSN)>

and here’s the init() method:

    <cfset variables.dsn = arguments.dsn>
    <cfset variables.dodaacDSN = arguments.dodaacDSN>

   <cfreturn this>

the above code snippet returns the following error when it calls the init()
method

“the function init has an invalid return value , can’t cast Object type
[Component CCMA.controller.ccmaService] to a value of type [c.ccmaService]”

c.ccmaService is a mapping created in the Application.cfc.

I’m wondering what I’m missing here…

Any help is greatly appreciated.

Thanks

Scott Stewart
DoDEA

Just a hunch without seeing the code for the component itself but it looks
like the returnType of the init function doesn’t match the name of the
component. Maybe try changing the returnType to just “ccmaService” without
the “c.” in front of it?

MikeOn Dec 7, 2015 3:36 PM, <@scott.stewart.ctr> wrote:

Hey all,

I’m porting an application over from Adobe ColdFusion 9. In the
application I have a web service call. In the CFC, I have this small bit of
code that calls the init method of the CFC in the event that the
datasources don’t exist in the variables scope of the CFC.
Here’s the calling code:

<cfif not StructKeyExists(variables, “dsn”)>


<cfset init(local.dsn, local.dodaacDSN)>

and here’s the init() method:

    <cfset variables.dsn = arguments.dsn>
    <cfset variables.dodaacDSN = arguments.dodaacDSN>

   <cfreturn this>

the above code snippet returns the following error when it calls the
init() method

“the function init has an invalid return value , can’t cast Object type
[Component CCMA.controller.ccmaService] to a value of type [c.ccmaService]”

c.ccmaService is a mapping created in the Application.cfc.

I’m wondering what I’m missing here…

Any help is greatly appreciated.

Thanks

Scott Stewart
DoDEA


Love Lucee? Become a supporter and be part of the Lucee project today! -
http://lucee.org/supporters/become-a-supporter.html

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 lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/44b61caf-0875-4592-b5c0-e0cdbabdbd35%40googlegroups.com
https://groups.google.com/d/msgid/lucee/44b61caf-0875-4592-b5c0-e0cdbabdbd35%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.