Skip to main content
nak33
Known Participant
January 25, 2022
Question

Component Reference

  • January 25, 2022
  • 3 replies
  • 553 views

Recently we received an error when calling cfinvoke:

"Neither the method querytoarray was found in component D:\Websites\ycWeb\trunk\yc\cfc_files\system\resource\company.cfc nor was there any default method with this name present in any of the implementing interface."

Here is the call that threw the error (which was made in the company.cfc):

<cfinvoke 
				component="#request.path.cfc.querytoarray#"
				method="querytoarray" 
				xquery="#qry_select_owners#"
				columnList="#lcase(qry_select_owners.columnList)#" 
				returnvariable="local.arrayResult" />


For some reason the initialization disregarded the value in the component attribute. 

 

I don't see how this could have occurred.  This only happened once and then didn't occur again.

 

    This topic has been closed for replies.

    3 replies

    Charlie Arehart
    Community Expert
    Community Expert
    December 20, 2024

    @nak33 , did you ever solve this problem? We never heard back from you after the last comments.

    /Charlie (troubleshooter, carehart. org)
    Charlie Arehart
    Community Expert
    Community Expert
    January 29, 2022

    I have a different take than the other discussion here. What if the message is misleading? Maybe it's not the ROOT cause error, and you're not seeing or being shown that root cause?

     

    If I had to guess, I'd wonder if the query you pass in, qry_select_owners, is in some situations NOT a query. That can happen for various reasons.

     

    So first, if you have error handling that's dumping the scope holding that var, what does it show? 

     

    If you don't have error handling, then just look at that cfc method in the cfc: do you define the xquery arg as being a type of "query"? If you do, then it would fail if it was not. Otherwise it would let it pass, and then later code in the method (which presumes to act on a query) would fail.

     

    And if somehow you can't modify the cfc (to see if adding a type would help), you could do a CFLOG of isquery(qry_select_owners) before the cf invoke. Is that ever false? 

     

    Indeed, you say the problem is intermittent so you could use the isquery as an if test done before the invoke, and only do the log if it's false. Then see if that log line appears when you get the error. 

     

    Let us know if any of this helps. 

    /Charlie (troubleshooter, carehart. org)
    BKBK
    Community Expert
    Community Expert
    January 26, 2022

    The variable 

    request.path.cfc.querytoarray

    is dynamic. The error message is telling us that, at the moment the error occurred, the value of this variable was

     D:\Websites\ycWeb\trunk\yc\cfc_files\system\resource\company.cfc

     

     

    nak33
    nak33Author
    Known Participant
    January 27, 2022

    You're stating that some routine updated that variable to set a new path? 

     

    It's only set in one line of code in the application, and then used by CreateObject function. 

     

    BKBK
    Community Expert
    Community Expert
    January 27, 2022
     

    You're stating that some routine updated that variable to set a new path? 

     

     

    By @nak33

     

    I am not. 🙂 ColdFusion is.

     

    There's one way to find out. When the error occurs, place the following line of code just before the cfinvoke:

    <cflog type="error" file="componentPathError" text="request.path.cfc.querytoarray = #request.path.cfc.querytoarray#">

    Then take a look at the log file afterwards.