Link to home
Start Free TrialLog in
Avatar of henderxe
henderxe

asked on

Coldfusion Error "The GetColumnNames method was not found" after Applying Patch

Please see attached two (2) files.  

One file (Coldfusion_Error.docx) contains the error message, as well as additional server information.
The other file (getSolicitCounts.cfm) is the file referenced in the error message.
Any assistance would be hugely appreciated.

Regards, and Thank you!
Coldfusion_Error.docx
getSolicitCount.txt
Avatar of _agx_
_agx_
Flag of United States of America image

(Edit: Never mind. Missed the version info in the 1st doc)

So it works with getSolicitCount, but not getExcludedSolicitCount? That suggests they are different object types.  (The variable name suggests it might be a count or number, rather than a query).  Can you CFDump getExcludedSolicitCount?

a) What are the contents
b) What type of object (query, number, ....)
c) What code generates it? ie Code inside idListGenerationObj.getExcludedIDlist (....)?
Avatar of henderxe
henderxe

ASKER

Hello agx,

   Sorry for the delay!

     Answers your questions follow:

    a)  It provides a list of the individuals who were EXCLUDED from the mailing list (e.g. folks who have mailing restrictions on their records, such as "Do not Contact", or "Do Not Mail", etc .
    b)  Query
    c)  See attached file for code (cffunction_getExcludedIDList.docx).

   Really appreciate it.  This is a production server.

   Regards,
cffunction_getExcludedIDList.docx
CFDUMP_Results.docx
I'll take a look at the new dumps later.  There's a couple things that might be problematic under certain conditions.  Having said that, honestly getColumnNames() is an undocumented function. Relying it on it is risky because there's always the possibility an update could break your code.  Not sure that' s the cause here, but given the new error it might be a good time to switch to a documented method.  

Unfortunately, CF doesn't provide a function that returns column names only, but you can create one from the query metatdata. Here's an example. Notice query columns are returned in the original SQL order, not alphabetical like query.columnList

Example:

 <cfset getExcludedSolicitCount = queryNew("ZZZ,AAA")>
 <cfset columnNameArray = getQueryColumnArray(getExcludedSolicitCount)>
 <cfdump var="#columnNameArray#">

Open in new window


Function:

 <cffunction name="getQueryColumnArray" returntype="array">
	<cfargument name="queryObject" type="query">
	<!--- get query metadata --->
	<cfset Local.queryMetadata = GetMetaData(arguments.queryObject)>
	<cfset Local.namesArray = []>
	<!--- extract column names and save to array --->
	<cfloop array="#Local.queryMetadata#" index="Local.queryCol">
		<cfset arrayAppend(Local.namesArray, Local.queryCol.Name)>
	</cfloop>
	<cfreturn Local.namesArray>
</cffunction>

Open in new window


Side note,
A) I noticed there's some cfcatch code commented out. Was that part of the original code, because returning "error" instead of query could definitely cause the method not found error.
<!--- <cfcatch type="any">
              <cfset error = "#cfcatch.sql#">
<cfreturn error/> --->

B) None of the function variables seem to be localized ie VAR/LOCAL.  That could cause problems under some conditions.
C) Probably not related to your error, but some of the queries are at risk for SQL injection. When you get a chance, update them to use cfqueryparam.
(I'd still recommend moving away from the undocumented function, but ...) I took a look at the code.  There's nothing obvious that should cause that error.  Try adding this debugging code just before the error is thrown:

<!--- debugging --->
<cfset clz = getExcludedSolicitCount.getClasss()>
<cfdump var="#clz#">
<cfset obj = createObject("java", clz.name)>
<cfdump var="#obj#">

<!--- line throwing the error --->
<cfset columnList = ArraytoList(getExcludedSolicitCount.GetColumnNames())>
agx

Sorry, I'm still here!  Trying to manage multiple issues involving other systems (data warehouse).

I will respond on all of my findings, based on your suggestions,  later this afternoon.

 Thanks very much for your input - really, really appreciated.
agx:

Get the following error when adding the debugging code above:

Message    The getClasss method was not found.
Detail        Either there are no methods with the specified method name and argument types or the getClasss method is overloaded with argument types that ColdFusion cannot decipher reliably. ColdFusion found 0 methods that match the provided arguments. If this is a Java object and you verified that the method exists, use the javacast function to reduce ambiguity.
Extended Info       
Tag Context       C:\ColdFusion9\wwwroot\art\views\cfm\exportReports\idListGeneration\getSolicitCount.cfm (27)
C:\ColdFusion9\wwwroot\MachII\framework\ViewContext.cfc (114)
C:\ColdFusion9\wwwroot\MachII\framework\EventContext.cfc (475)
C:\ColdFusion9\wwwroot\MachII\framework\commands\ViewPageCommand.cfc (92)
C:\ColdFusion9\wwwroot\MachII\framework\EventHandler.cfc (88)
C:\ColdFusion9\wwwroot\MachII\framework\RequestHandler.cfc (386)
C:\ColdFusion9\wwwroot\MachII\framework\RequestHandler.cfc (334)
C:\ColdFusion9\wwwroot\MachII\framework\RequestHandler.cfc (278)
C:\ColdFusion9\wwwroot\MachII\framework\RequestHandler.cfc (208)
C:\ColdFusion9\wwwroot\MachII\mach-ii.cfm (130)
C:\ColdFusion9\wwwroot\art\index.cfm (9)

Thanks.
<cfset clz = getExcludedSolicitCount.getClasss()>

Open in new window


Sorry, typo - my bad.  It should be getClass()  not getClasss().
agx:

   I'm not getting any output (or results with the above debugging code.  I even added a <cfabort> at the end of the"<cfdump>" lines, and still nothing.  I placed the code exactly as you suggested.
Is there something else I need to add, and what type of results are you expecting?

Thanks!
(Edit: Added try/catch to code snippet)

No, that should be all you need.  

 Since that method should work w/any query object, the error suggests getExcludedSolicitCount doesn't actually contain a query when it occurs.  Here's a standalone example and the expected results.  It should produce a dump of the class, telling us what type of object "getExcludedSolicitCount" is AND whether its really missing a getColumnNames() method as the error message claims....

BTW, any change if you use the alternate method of grabbing the column names?

Standalone example

<!--- simulate query returned from CFC --->
<cfset getExcludedSolicitCount = queryNew("ID,Name")>
<!--- debugging --->
<cfset clz = getExcludedSolicitCount.getClass()>
<cfdump var="#clz#">
<cfset obj = createObject("java", clz.name)>
<cfdump var="#obj#">

<cftry>
       <cfdump var="#getExcludedSolicitCount.getColumnNames()#">
    <cfcatch>
           <cfdump var="#cfcatch#">
     </cfcatch>
</cftry>

Open in new window



User generated image
User generated image
_agx

    Sorry  .  . will respond shortly!

Andy
_agx:

  Truly appreciate your patience!

The results of your "alternate method", and determining if the "getColumnNames" method actually exists, is in the attached file.  It appears that it does NOT exists.
  However, this application as worked the past 4 years, or so.

 I'm told that the Coldfusion error could be due to a "failed" AJAX call.  If this is "out of scope" of our original conversation, please let me know, and I'll submit another question, giving you full credit for this one, of course.

   Included in the attached file is an error message generated by Firebug.  I have attached the function referred to in the "main.js" file cited in the error by Firebug (Line 2354), which I've highlighted in yellow.  I can say with certainty that it all leads back to the original error on Line 27 in the first files I sent to you (getSolicitCount.cfm).

I have some, but not a lot of knowledge of either Javascript, or AJAX.  Let me know if you need additional information.

 Thank you!!
cf_methods.docx
_agx:

   The file I uploaded is incomplete!

  Uploading complete file!

Thanks
cf_methods_other_stuff.docx
It appears that it does NOT exists.

You need to expand the dump to show the parent class too (not expanded by default). Notice in the earlier dump that method is actually defined in the parent class:  coldfusion.sql.Table


I'm told that the Coldfusion error could be due to a "failed" AJAX call.

Hm... I don't see how, since it's clearly a CF error message.

Variable getQueryColumnArray is undefined

From the error message, it sounds like you forgot to add the function to that page:

<cffunction name="getQueryColumnArray" returntype="array">
	<cfargument name="queryObject" type="query">
	<!--- get query metadata --->
	<cfset Local.queryMetadata = GetMetaData(arguments.queryObject)>
	<cfset Local.namesArray = []>
	<!--- extract column names and save to array --->
	<cfloop array="#Local.queryMetadata#" index="Local.queryCol">
		<cfset arrayAppend(Local.namesArray, Local.queryCol.Name)>
	</cfloop>
	<cfreturn Local.namesArray>
</cffunction>

Open in new window

The file I uploaded is incomplete!

Got it.   If an error occurs in the CF code, that could definitely cause an cascade error with the ajax.  I'll have to take a closer look at the ajax dump.
_agx:

  OK - great!

 BTW, I did add the function, but not to the same page.  Instead, I tried to integrate it with  the file (idListGenerationDAO.cfc).   See file (function_results)  for results.

User generated image
 See file (getColumnNames_Table)  for results that I missed earlier:

User generated image
Regards!
So is it working now? :)

BTW, I did add the function, but not to the same page.  Instead, I tried to integrate it with  the file (idListGenerationDAO.cfc).   See file (function_results)  for results.

I don't see those files, but ... that should work too, as long as it's public.  Just access it through the
idListGenerationObj object. Not tested, but something like:

<cfset columnNameArray = idListGenerationObj .getQueryColumnArray(getExcludedSolicitCount)>
_agx:

   The error I showed earlier (getQueryColumnArray Undefined), was when I attempted to integrate it with the following lines in "getSolicitCount.cfm"

<cfset getExcludedSolicitCount = queryNew("ZZZ,AAA")>
                         <cfset columnNameArray = getQueryColumnArray(getExcludedSolicitCount)>
                         <cfdump var="#columnNameArray#">

and the function in the file "isListGenerationDAO.cfc".

The results above were generated as a "standalone" test to see if it worked.  It has to be integrated with the above mentioned files in order work properly.  I'm not seeing the connection at this point.

  Can you place it where you think it needs to go in both files?
_agx:

Attaching the function in "idListGenerationDAO.cfc", which may be helpful!
getExcludedIDList_Function.docx
_agx:

  I just saw where you suggested how to integrate with the file (idListGenerationDAO.cfc..  I'll give that a try!
ASKER CERTIFIED SOLUTION
Avatar of _agx_
_agx_
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
_agx:

   Sorry .  .  . too many things going on!

   I'll respond with the latest results probably this evening.

   Thanks!
_agx

  Many apologies for the delay!

I finally got your revised CF function to work, which was extremely helpful, in that it brought forth the true reason for the CF error.

  A stored procedure failed when attempting to make a database call with the error:  "ORA- 00054: resource busy and acquire with NOWAIT  specified or timeout expired" .

   Anyway, truly appreciate your assistance.  Changed my focus from strictly CF to other areas (e.g. database).

   Thanks, again!
No worries at all.   I remember seeing your last comment about solving it and could have sworn I'd responded, but .. I guess got busy too :-)  Anyway, don't you love those "red-herring" type problems?  It's always extremely satisfying when you finally figure it out.  Glad you finally tracked it down!
agx

  Wow - didn't realize this was still open!

  Yes - tracking it to the database was certainly somewhat of a relief.

   But another issue has surfaced which I'll send as a separate question.

   Thanks again!