0

I restarted my CF2018 server using CommandBox, and I guess none of my previous settings were saved. I've tried everything I can think of, but can't get past this error:

Could not find the ColdFusion component or interface query.

var config_qry = new Query(datasource = this.dsn); //hitting error on this line

config_qry.setSQL('UPDATE t_table SET col1 = cast(:newConfig as json) WHERE default_url like :default_url');

I am pretty sure it's a setting in my CFAdmin that's incorrect, but can't pinpoint what it could be. I've verified that the DSN is working and that's not a problem. It seems to be that the keyword "Query" is not being recognized as a coldfusion word, so it's looking for a component with that name. If I simplify it and try it this way, I'm getting the same error.

var config_qry = new Query();

I'm not sure what else to try. Thank you for the help!

Crystal
  • 1
  • 1
  • 2
    The Query.cfc component gets loaded from {cf_root_path}\cfusion\CustomTags. Look in *CF Admin => Extensions => Custom Tag Paths => Current Custom Tag Paths* and see if that path exists. If not, try adding it ... – SOS Sep 24 '21 at 17:50
  • Just did a test commandbox install of CF2018 and the path added looked like this C:\{commandbox_root}\server\{BigLongServerID}\adobe-2018.0.12.328566\WEB-INF\cfusion\CustomTags – SOS Sep 24 '21 at 18:34
  • Seems that you are using Adobe's Query.cfc custom tag and that component isn't being found on your cfengine. What happens if you call it with new com.adobe.coldfusion.query()? Or your mapping is wrong or the component is missing. Also, that type of queries became obsolate. Consider trying the more modern cfscript approach with cfqueryExecute(). – AndreasRu Sep 25 '21 at 03:22
  • Or queryExecute(). The customTag path is probably missing or wrong, because Query.cfc should function out of the box since the installer adds the both the cfc and path automatically. If it is not working, first place to look is the paths in the extension screen. If the path is missing, or wrong, the com.adobe.coldfusion.query() syntax will fail too. – SOS Sep 26 '21 at 01:04
  • Thank you for your help. I'm am not able to add that custom path at all. In my WEB-INF folder, there is not a cfusion folder. All that's in there is cfform folder, and 2 files - j2ee-web.xml and web.xml. Maybe I'm not in the right place. I did have this server running earlier, but ran into these issues when I did a restart. – Crystal Sep 27 '21 at 20:27
  • Hm... I think that must be the wrong place as I can't see CF loading at all without the "cfusion" folder (: So you're able to get into the CF Admin, yes? You could check the Server Settings Summary and many of the settings contain the base install path. Though there's probably slicker ways to get the server install path – SOS Sep 27 '21 at 22:30
  • Doh... my brain is tired. If you can run any .cfm scripts, output `` – SOS Sep 27 '21 at 22:33
  • You might ask on slack, as there are a bunch of people more knowledgeable about commandbox than I am. Try the "commandbox" channel on either https://cfml.slack.com/ or https://boxteam.slack.com/ – SOS Sep 28 '21 at 02:05
  • 1
    Ha, ha! That did the trick. Using the helped me locate where the CustomTags folder was sitting, and once I added that CustomTag path, everything is up and running again. Thank you so much for your help! – Crystal Sep 29 '21 at 12:15

1 Answers1

0

Query.cfc is one of several Adobe components that gets loaded from the {cf_root_path}\cfusion\CustomTags directory. Look in CF Admin => Extensions => Custom Tag Paths => Current Custom Tag Paths and see if that path exists. If not, try adding it. To find the root path for your CommandBox install, output:

<cfdump var="#server.coldfusion.rootdir#">

Also as @AndreasRu mentioned in the comments you might consider switching to QueryExecute instead. See this old blog entry for a few of the advantages over Query.cfc.

SOS
  • 6,430
  • 2
  • 11
  • 29