Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
If you choose to investigate further, please share the contents of your Application.cfc. If it contains sensitive information, send it by private messaging.
Copy link to clipboard
Copied
@BKBK,
Here is my Application.cfm It worked perfectly in CF9 for many year.
<cfcomponent>
<cfset THIS.name="PROD">
<cfset THIS.sessionManagement="true">
<cfset THIS.clientManagement="true">
<cfset THIS.setClientCookies="true">
<cfset THIS.applicationTimeout=CreateTimeSpan(1,0,0,0)>
<cfset THIS.sessionTimeout=CreateTimeSpan(0,0,20,0)>
<cffunction name="onApplicationStart">
</cffunction>
<cffunction name="onApplicationEnd">
</cffunction>
<cffunction name="onSessionStart">
<cftry>
<cfif find("SPI\",#CGI.Auth_User#)>
<cfset curr_user = listlast(#CGI.Auth_User#,"SPI\")>
<cfset SESSION.curr_user = UCase(curr_user)>
<cfelse>
user not found !!!
<cfabort>
</cfif>
<cfquery name="get_roles" datasource="#REQUEST.dsn#">
query goes here ...
</cfquery>
<cfif get_roles.RecordCount GT 0>
<cfset rolesArray=ArrayNew(1)>
<cfloop query="get_roles">
<cfset rolesArray[CurrentRow] = "/" & link_home[CurrentRow] & "/">
</cfloop>
<cfset SESSION.userRoles = rolesArray>
</cfif>
<cfcatch>
onSessionStart Error
<cfdump var="#cfcatch#">
<cfabort>
</cfcatch>
</cftry>
</cffunction>
<cffunction name="onRequestStart">
<cfif not structKeyExists(session,"curr_user")>
<!--- The session has been lost, restart it... --->
<cfset onSessionStart() />
</cfif>
<cfif NOT isDefined("URL.contentonly")>
<table width="100%" border="0" bgcolor="">
<tr align="center">
<td><img src="\prod\IMAGES\logo.jpg" width="886" height="87" border="0"></td>
<td class="TH">Welcome <cfoutput>#session.curr_user#</cfoutput><br></td>
</tr>
</table>
<hr size="3">
</cfif>
<cftry>
<cfif not structKeyExists(session, "curr_user")>
You are not a valid user.
<cfabort>
</cfif>
<!--- Check if userRoles exist in SESSION --->
<cfif not structKeyExists(session, "userRoles")>
You have no roles assigned.<br>
Please contact your web administrator.
<cfabort>
</cfif>
<!--- Get the name of the current template (from where request is coming from) --->
<cfset currentPage = listLast(cgi.script_name,"/") />
<cfset SESSION.curr_page = currentPage>
<cfif not listfindNoCase("index.cfm,login.cfm,logout.cfm", currentPage)>
<cfset userRoles = SESSION.userRoles>
<cfset foundit = true>
<cfset i = 0>
<cfloop condition = "(NOT foundit) AND (i LT ArrayLen(userRoles))">
<cfset i = i + 1>
<cfif find(#userRoles#,#currentPage#)>
<cfset foundit = True>
</cfif>
</cfloop>
<cfif not foundit>
You do not have permission to view this page
<cfabort>
</cfif>
</cfif>
<cfcatch>
<cfdump var="#cfcatch#">
<cfabort>
</cfcatch>
</cftry>
</cffunction>
<cffunction name="onRequestEnd">
<cfif NOT isDefined("URL.contentonly")>
<p align="right">
<cfoutput>
<font size="2" face="sans-serif" color="black">
<i>©#Year(Now())#</i><BR>
</cfoutput>
</p>
</cfif>
</cffunction>
<cffunction name="onSessionEnd">
</cffunction>
<cffunction name="onError" returnType="void" output="true">
<cfargument name="exception" required="true">
<cfargument name="eventname" type="string" required="true">
<cfset var errortext = "">
<!--- Display error to user --->
<img src="../../IMAGES/SiteError.gif" width="750" height="150" alt="Site Error" border="0">
<p></p>
Error: <cfoutput><strong>#arguments.exception.message#</strong></cfoutput><br />
Error details were sent to the application administrator.<br />
<p></p>
<a href="<cfoutput>#CGI.http_referer#</cfoutput>">Go Back</a>
<cfsavecontent variable="errortext">
<cfoutput>
Time: #dateFormat(now(), "short")# #timeFormat(now(), "short")#<br />
Error on page: http://#cgi.server_name##cgi.script_name#?#cgi.query_string#<br />
Referrer: #cgi.HTTP_REFERER#
</cfoutput>
<cfdump var="#arguments.exception#" label="Error">
</cfsavecontent>
<cfmail to="me@company.com"
from="cf@company.com"
subject="ColdFusion request failed for #UCase(listlast(SESSION.curr_user,"\"))#"
type="html">
#errortext#
</cfmail>
</cffunction>
</cfcomponent>
Copy link to clipboard
Copied
You should save this file as Application.cfc (in case you had mistakenly saved it as application.cfm).
Copy link to clipboard
Copied
EugenePipko wrote
<cffunction name="onApplicationStart">
</cffunction>
Use this instead:
<cffunction name="onApplicationStart" returntype="boolean">
<cfreturn true>
</cffunction>
Copy link to clipboard
Copied
Now, I am a bit confused. You mention Application.cfm.
When I look back I see D:/Application.cfc and D:/UB_CF_APPS/PROD/Application.cfc.
Which one do you use? What is its path? What is the path of the folder containing the CFM files that you are testing?
Copy link to clipboard
Copied
What happens if you just <cfdump var="#arguments#" label="arguments" />? Instead of targeting just arguments.exception, dump the whole arguments scope.
V/r,
^ _ ^
Copy link to clipboard
Copied
<cfdump var="#arguments#" label="arguments" /> returns the following data, but I receive the same errors
I was thinking: it's definitely related to #arguments#, then how do I list all of possible once, as Charlie suggested and by process of elimination find the one that fails?
Copy link to clipboard
Copied
Well, at least it's showing that the issue triggering the error is the CFPRINT (which you did mention.)
But the fact that getMetaData() isn't available when the error is triggered is concerning. Makes me think that it _is_ available up until the point where the error happens, then is suddenly not available. As if CFPRINT is removing or blocking it in that moment.
HTH,
^ _ ^
Copy link to clipboard
Copied
I misspelled Application extension. It should of been .cfc
I installed second update and according to update log, it installed successfully.
I was hoping that there is something in it that could of help, but... no, I still have same issues.
Made a change to onApplicationStart as you suggested.
Question: how do I pull all keys in #arguments#? I still would like to go one-by-one see which one causes the issue.
Copy link to clipboard
Copied
What is the path of the Application.cfc whose contents are as above? What is the path of the folder containing the CFM files that you are testing?
It might help to clear the caches. To do so, open the ColdFusion Administrator and press on the buttons to clear cached templates and cached components.
EugenePipko wrote
Question: how do I pull all keys in #arguments#? I still would like to go one-by-one see which one causes the issue.
Two answers:
1) A slight variation on WolfShade 's suggestion:
<cfdump var="#arguments#" format="html" output="#expandpath('arguments.html')#">
This will create an HTML file within the current directory.
2) Alternatively, the try-catch (within onError) that I suggested yesterday.
Copy link to clipboard
Copied
Does the following workaround work?
<cfsavecontent variable="errortext">
<cfoutput>
Time: #dateFormat(now(), "short")# #timeFormat(now(), "short")#<br />
Error on page: http://#cgi.server_name##cgi.script_name#?#cgi.query_string#<br />
Referrer: #cgi.HTTP_REFERER#
</cfoutput>
<cfscript>
writedump(var="#arguments.exception#", label="Error");
</cfscript>
</cfsavecontent>
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
I tried the same thing: copied onError method to an empty Application.cfm
Received the same error
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
You're right, I have another issue with <CFPRINT> not working, so I am using the page I have with that tag in it to trigger an error
Copy link to clipboard
Copied
EugenePipko wrote
You're right, I have another issue with <CFPRINT> not working, so I am using the page I have with that tag in it to trigger an error
Ignore the cfprint page for a moment. What happens when you test the onError by running this page:
testpage.cfm
<!--- this causes a division-by-zero exception --->
<cfset x= 1/0 >
Copy link to clipboard
Copied
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_...
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.
Copy link to clipboard
Copied
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)
Copy link to clipboard
Copied
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>
Copy link to clipboard
Copied
Hi EugenePipko,
You were indeed on to something. It was a ColdFusion bug.
I reported it in Tracker, and it has been fixed.
Copy link to clipboard
Copied
BKBK, thanks for the news (and the effort). And you've confirmed the fix, it seems, right? (There's no indication in the bug report.) If so, great.
Can you confirm if it was update 10 of cf2018 that adds that fix, perhaps? Again that's not clear from the bug report, which indicates only that it's closed, with the "fixed in build" number. While that number is less than the build number of 10 and above that of 9, the tracker id itself is not listed in the "bugs fixed" for update 10, at
https://helpx.adobe.com/coldfusion/kb/coldfusion-2018-update-10.html.
Not hassling you here. Just wanting to clarify for any wanting to see the benefit of this fix. Or must they request a special hot fix jar for now, do you know? Again, thx.
Copy link to clipboard
Copied
Hi Charlie,
I don't know whether there is a JAR available for the fix. Like you, all I know is the information published on Tracker, namely:
Copy link to clipboard
Copied
I'm upgrading a cf9 app to 2016, and cfdumping any exception gives the error "The getMetaData method was not found".
Other cfdumps are fine.
Do I understand that this wasn't fixed until 2018 cf10?
That's a really big gap, surprising and unfortunate.
In any case, I already had hf10 for 2018 installed, didn't fix the error.
The hf10 install log showed only successes.
I tried to install hf11, to see if that helped and to get current, but that failed.
I tried to uninstall hf10, since hf11 says it contains all previous hotfixes, but that failed too.
So:
- Does anyone else see this problem with 2018 hf10? Any resolution?
- Given the bent hotfix situation, any suggestions for a way forward? Delete the entire hf-updates directory?
Thanks in advance for any assistance.
(Also this page thinks my post has errors and won't accept it, but doesn't say what they are. I tried again, and now it says "post flooding detected", and I have to wait an hour. Bleh.)
Copy link to clipboard
Copied
You should be able to just delete the hotfix manually, per the uninstallation instructions:
"If you can't uninstall the update using the above-mentioned uninstall options, the uninstaller could be corrupted. However, you can manually uninstall the update by doing the following:
After deleting it, I'd install hotfix 11 and see if that solves your problem.
Dave Watts, Eidolon LLC
Copy link to clipboard
Copied
dmerril, I can confirm there is NOT a general issue of CF2018 update 10 being unable to dump exceptions. Same with update 11. See code below. Maybe you are doing something differing in "dumping an exception" than I show.
And while I get it that you're saying you feel there was no problem in your applying update 10 (so that's not the problem for you, and thanks), while it seems you ARE having problems applying update 11, again neither update has a general error at least running this code:
<cfscript>
try {
x=y;
}
catch (any excp) {
writedump(excp);
}
</cfscript>
or for those who may prefer tags:
<cftry>
<cfset x=y>
<cfcatch>
<cfdump var="#cfcatch#">
</cfcatch>
</cftry>
Can you first confirm if those work for you, on your setup? And if so, then modify them until they create the problem you see, that leads to the getmetadata problem.
If somehow even this code DOES fail for you, then it would seem you have some environmental issue that makes it NOT work for you. We can cross that bridge if/when we get there.
Please let us know how it goes.