Today while working with a ColdFusion component and attempting to create a constructor name init, I came across the below error :

The value returned from function init() is not of type manager.
If the component name is specified as a return type, the reason for this error might be that a definition file for such component cannot be found or is not accessible.

Doing a search online yielded unhelpful (at least in my situation) results. I was completely confused as to why my init constructor function would work on other cfc’s, but not on this one. My init function was simple:


<cffunction name="init" access="public" returntype="manager">
	<cfargument name="dsn" type="string" required="yes">
		<cfset this.dsn = arguments.dsn>
	<cfreturn this>
</cffunction>

And my component:
<cfcomponent hint="manager">
But… Since ColdFusion is Java based, if I wanted to do this I would need to make sure that not only should my init function return this, and the returntype be the same name as the component hint, but the page needed to be named the same as those two as well.

And yes! After all of that, the init function worked as expected.



One Response to “The value returned from function init() is not of type…”  

  1. 1 Gerry

    Thanks, I was beating my head on this one.


Leave a Reply