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

39 views
Skip to first unread message

scott.st...@hq.dodea.edu

unread,
Dec 7, 2015, 3:36:08 PM12/7/15
to Lucee
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 local.dsn="CCMA">
            <cfset local.dodaacDSN = "DODEA">
         <cfset init(local.dsn, local.dodaacDSN)>
 </cfif>
 
and here's the init() method:
 
<cffunction name="init" access="public" returntype="c.ccmaService">
        <cfargument name="dsn" type="string" required="yes">
        <cfargument name="dodaacDSN" type="string" required="yes">
 
        <cfset variables.dsn = arguments.dsn>
        <cfset variables.dodaacDSN = arguments.dodaacDSN>
 
       <cfreturn this>
</cffunction>
 
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


 

Michael Sprague

unread,
Dec 7, 2015, 3:52:17 PM12/7/15
to lucee

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?

Mike

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

scott.st...@hq.dodea.edu

unread,
Dec 7, 2015, 4:08:07 PM12/7/15
to Lucee
That fixed that issue ... now to the next one ...
 
Thanks
 
Scott Stewart
Reply all
Reply to author
Forward
0 new messages