Skip to main content
Inspiring
February 19, 2019
Question

How to fix "getMetaData method was not found" error

  • February 19, 2019
  • 3 replies
  • 9599 views

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 has been closed for replies.

3 replies

Charlie Arehart
Community Expert
February 21, 2019

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.

/Charlie (troubleshooter, carehart. org)
Inspiring
February 21, 2019

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)

Charlie Arehart
Community Expert
September 24, 2020

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>

 

/Charlie (troubleshooter, carehart. org)
Inspiring
February 20, 2019

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.

Inspiring
February 20, 2019

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

Received the same error

BKBK
Community Expert
February 20, 2019

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?

WolfShade
Brainiac
February 19, 2019

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,

^ _ ^

Inspiring
February 19, 2019

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?

Inspiring
February 20, 2019

Hmmm, odd. What happens when you run the following CFM page. It contains just 1 line.

testpage.cfm

<cfdump var="#server#">


<cfdump var="#server#"> works just fine

the workaround using <cfscript> does not work: shows same errors