Skip to main content
Inspiring
Feb 19, 2019 5:28 PM UTC
Question

How to fix "getMetaData method was not found" error

Hello,

I installed CF2018 on Win2016 server and moved my code into it from CF9. Now I am receiving errors that I did not receive in CF9.

09:15:16.016 - Object Exception - in D:/Application.cfc : line 249

The getMetaData method was not found.

09:15:16.016 - Application Exception - in D:/Application.cfc : line 249

An exception occurred while calling the function getMetaData.

The line 249 refers to the <cfdump> tag in the following function in Application.cfm

<cffunction name="onError" returnType="void" output="false">

<cfargument name="exception" required="true">

<cfargument name="eventname" type="string" required="true">

        <cfset var errortext = "">

   

        <cfif isDefined("arguments.exception.rootCause") AND arguments.exception.rootCause IS "coldfusion.runtime.AbortException">

            <cfreturn/>

        </cfif>

            

<cfmail

to="me@company.com"

from="cf_server@company.com"

subject="ColdFusion request failed for #UCase(listlast(SESSION.curr_user,"\"))#"

type="html">

<p><strong>Error: <font color="red">#arguments.exception.message#</font></strong></p>   

        <strong>Time:</strong> #dateFormat(now(), "short")# #timeFormat(now(), "short")#<br>

        <strong>Error on page:</strong> http://#cgi.server_name##cgi.script_name#?#cgi.query_string#<br>

        <strong>Referrer:</strong> #cgi.HTTP_REFERER#   

    <p></p>

       <cfdump var="#arguments.exception#" label="Error">

</cfmail>

    <cfabort>

</cffunction>

Does anyone know how to fix it?

Thanks,

Eugene

This topic is closed to new replies. Start a new post to keep the conversation going.

70 replies

Charlie Arehart
Community Expert
Community Expert
Feb 21, 2019 5:20 AM UTC

Eugene, before digging any further than you guys have, note that your error (which is indeed unusual) could be because of an error during your having applied a CF update.

So can you confirm first simply if you applied any updates once you moved to CF2016? If so, can you confirm if the last update you did had any errors?

See the cfusion\hf-updates folder, for that last update. Then see the last install log in that folder. And near the top of that log will be a table counting successes and errors. Any errors? 

If so, see a blog post I have about the many things that can go amiss during updates, and how to recover:

https://www.carehart.org/blog/client/index.cfm/2016/9/6/solve_common_problems_with_CF_updates_in_10_and_above

If that's not it, you would agree that if you remove the cfdump of the arguments.exception scope, the error goes away, right? And what if you do a structlist(arguments.exception)? Maybe what's in there is at issue. You could then dump the keys within that, one at a time (like arguments.exception.message, and so on), to see which it really fails on. That may help you to know WHERE specifically the failure of getmetadata is, then perhaps you can tackle the why and how.

Translate
/Charlie (troubleshooter, carehart. org)
Inspiring
Feb 21, 2019 5:29 PM UTC

Charlie,

Update_1 was installed and I cannot find anything wrong (by looking into .log file). All entries show Status: SUCCESSFUL

I like what you proposed: list of the keys of argument.exception(), but I am not sure how to do so.

structlist(arguments.exception)

Translate
Charlie Arehart
Community Expert
Community Expert
Sep 24, 2020 12:01 AM UTC

Eugene, how did things turn out?

 

BTW, in case anyone else gets to this point and may have the same question (about checking if any recent CF update you applied had errors), where I asked to check the update log, it's not the phrase "sucessful" you should look for, but "successes". As I explain in my blog post (that I point to), there's a table near the top of the log, that tracks successes and errors. That's what you want to see 0 errors.

 

As for how to "list of the keys of argument.exception()", I see I had said structlist, but I meant structkeylist, as in structkeylist(arguments.exception). And when I said to loop over what's in that, you could do that (old-school) with something like this. It's not perfect (and you could wrap a try catch around it to catch when it may fail because of nested objects). The point is that you may find WHERE it fails, within the current dump you do of that exception struct:

<cfloop item="x" collection="#arguments.exception#">
	<cfoutput>
	<b>#x#</b> - 
	<cfif isobject(arguments.exception[x])>
		<cfdump var="#arguments.exception[x]#">
	<cfelse>
		#arguments.exception[x]#
	</cfif>
	<br>
	</cfoutput>
</cfloop>

 

Translate
/Charlie (troubleshooter, carehart. org)
Inspiring
Feb 20, 2019 10:42 PM UTC

Do you know, what exception is thrown? Do you throw the exception yourself using cfthrow?

I very quickly tried your sample. I copied your onError method to an otherwise empty Application.cfc and filled the session variable with a constant 0 .

I created an exception using cfthrow and got the mail as expected.

I used ColdFusion 2018 in a CommandBox setup. I guess it's already been updated to the most recent version - Update 2.

I'm not sure if getMetaData exists for every datatype. Therefore I assume your exception contains some data that's usually not contained in an exception.

Translate
Inspiring
Feb 20, 2019 10:57 PM UTC

I tried the same thing: copied onError method to an empty Application.cfm

Received the same error

Translate
BKBK
Community Expert
Community Expert
Feb 20, 2019 11:07 PM UTC

Back to basics. To get onError to run, an exception had to be triggered somewhere. So, in your tests, how did you get onError to run every time?

Translate
WolfShade
Legend
Feb 19, 2019 6:01 PM UTC

I don't have an answer for your question, but I must say that CF9 => CF2018 is a HUGE jump.  You should be getting all kinds of errors with CF9 code, for a variety of reasons including (but not limited to) deprecated tags, deprecated/altered attributes and/or parameters, and just plain security issues.

You just might have a lot of code to rewrite in order to keep this site/app running under CF2018.

V/r,

^ _ ^

Translate
Inspiring
Feb 19, 2019 6:06 PM UTC

Thanks for reply. So far, this is the only message I am receiving after upgrade.

Since it referring to #arguments.exception#, is there a new way to report an error in 2018?

Translate
WolfShade
Legend
Feb 19, 2019 7:51 PM UTC

I haven't worked with anything after CF11, so unfortunately can't help with that.  But hopefully someone with CF2018 experience will look in here and post some suggestions.

V/r,

^ _ ^

Translate