Highlighted

Coldfusion 2016 - Error invoking CFC

New Here ,
Feb 21, 2017

Copy link to clipboard

Copied

Hello,

We're upgrading from CF8 to CF2016, and as with all big revisions leaps there are certain pain points. My current one is accessing any of our CFCs. Of course they fine work in CF8, but dropped into CF2016 suddenly they can not be found even though they are in the same folder as the web app that is calling them.

Here's what I have debugged so far for one web app:

1. Yes, the functions in the CFC work. I tested them with CFINVOKE.

2. I've played with various paths, from the root to the specific folder. (ie cfc:webroot.next.next.etc.autosuggest)

3. I've also moved the CFC around but no success.

We're using Windows 2012.

Here's the current set up (yes, I know CF is moving away from the autoSuggest with CFINPUT, but work with me, I'm upgrading not updating.)

<cfinput onFocus="textHighlight('textedit')" type="text" name="Clinical_Rep_Auto" size="50" maxlength="50" value="" autosuggest="cfc:autosuggest.findClinicalNameWithNetID({cfautosuggestvalue})" autosuggestminlength="2" maxresultsdisplayed="20" />

I know CFCs require full mapping, and I believe I've done that simply because it only errors out when typing in the textbox, then suddenly it doesn't know where the CFC is.

Anybody else run into this with CF2016?

Thanks,

Ty

Adobe Community Professional
Correct answer by BKBK | Adobe Community Professional

Odd. We are assuming of course that the form page (index.cfm) and the CFC (autosuggest.cfc) are in the same directory. Then, as Haxtbh says, this behaviour also suggests a mapping. Is there a mapping to the CFC in the ColdFusion Administrator?

In any case, there is a workaround. Create the following mapping in the ColdFusion Administrator:

Logical Path: /proctorEvaluation

Directory Path: D:\webRoot\inweb\app\ProctorEvaluation

Then modify your code to:

<cfinput onFocus="textHighlight('textedit')" type="text" name="Clinical_Rep_Auto" size="50" maxlength="50" value="" autosuggest="cfc:proctorEvaluation.autosuggest.findClinicalNameWithNetID({cfautosuggestvalue})" autosuggestminlength="2" maxresultsdisplayed="20" />

This workaround has the advantage of leaving the rest of your code intact.

Views

1.2K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Coldfusion 2016 - Error invoking CFC

New Here ,
Feb 21, 2017

Copy link to clipboard

Copied

Hello,

We're upgrading from CF8 to CF2016, and as with all big revisions leaps there are certain pain points. My current one is accessing any of our CFCs. Of course they fine work in CF8, but dropped into CF2016 suddenly they can not be found even though they are in the same folder as the web app that is calling them.

Here's what I have debugged so far for one web app:

1. Yes, the functions in the CFC work. I tested them with CFINVOKE.

2. I've played with various paths, from the root to the specific folder. (ie cfc:webroot.next.next.etc.autosuggest)

3. I've also moved the CFC around but no success.

We're using Windows 2012.

Here's the current set up (yes, I know CF is moving away from the autoSuggest with CFINPUT, but work with me, I'm upgrading not updating.)

<cfinput onFocus="textHighlight('textedit')" type="text" name="Clinical_Rep_Auto" size="50" maxlength="50" value="" autosuggest="cfc:autosuggest.findClinicalNameWithNetID({cfautosuggestvalue})" autosuggestminlength="2" maxresultsdisplayed="20" />

I know CFCs require full mapping, and I believe I've done that simply because it only errors out when typing in the textbox, then suddenly it doesn't know where the CFC is.

Anybody else run into this with CF2016?

Thanks,

Ty

Adobe Community Professional
Correct answer by BKBK | Adobe Community Professional

Odd. We are assuming of course that the form page (index.cfm) and the CFC (autosuggest.cfc) are in the same directory. Then, as Haxtbh says, this behaviour also suggests a mapping. Is there a mapping to the CFC in the ColdFusion Administrator?

In any case, there is a workaround. Create the following mapping in the ColdFusion Administrator:

Logical Path: /proctorEvaluation

Directory Path: D:\webRoot\inweb\app\ProctorEvaluation

Then modify your code to:

<cfinput onFocus="textHighlight('textedit')" type="text" name="Clinical_Rep_Auto" size="50" maxlength="50" value="" autosuggest="cfc:proctorEvaluation.autosuggest.findClinicalNameWithNetID({cfautosuggestvalue})" autosuggestminlength="2" maxresultsdisplayed="20" />

This workaround has the advantage of leaving the rest of your code intact.

Views

1.2K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Feb 21, 2017 0
Advocate ,
Feb 22, 2017

Copy link to clipboard

Copied

What is the exact error?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 22, 2017 0
New Here ,
Feb 22, 2017

Copy link to clipboard

Copied

The error is "Error invoking CFC," which displays in a popup message once you start typing in the textbox. The rest of the message states that the CFC can not be found. As mentioned, CF initially knows when the page loads that it's there because if the CFC is moved to another location or I map it differently the page loads with an error that states the CFC can not be found, be sure to map it, etc.

I agree with you, Dave, but the mandate from above at the moment dictates otherwise. They would rather pull the feature than have me spend time rewriting code.

I suspect this issue started with an earlier version of CF, not specifically with CF2016.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 22, 2017 0
Engaged ,
Feb 22, 2017

Copy link to clipboard

Copied

Check the browser developer console for an error.  I suspect there will be something there.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 22, 2017 0
New Here ,
Feb 22, 2017

Copy link to clipboard

Copied

I overlooked something last week in Firebug:

the GET statement when the autoSuggest fires is adding 2 higher level path layers to it: webRoot/inweb. The URL should be when fired:

http://OurDomainHere.com/app/ProctorEvaluation/autoSuggest.cfc?method=findClinicalNameWithNetID&_cf_......

but is actually building

http://OurDomainHere.com/webRoot/inweb/app/ProctorEvaluation/autoSuggest.cfc?method=findClinicalName......

And since that full path doesn't resolve the error message pops up. We set up our IIS (8.5.9) identical to the way we had it on the older server (6.0), but for some reason the physical paths for the home directory are being treated differently between the two.

Thoughts?

Raw output.

GET /webRoot/inweb/app/ProctorEvaluation/autoSuggest.cfc?method=findClinicalNameWithNetID&_cf_ajaxproxytoken=&returnFormat=json&argumentCollection=%7B%22search%22%3A%22st%22%7D&_cf_nodebug=true&_cf_nocache=true&_cf_rc=2 HTTP/1.1

Host: OurDomainHere.com

User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0

Accept: */*

Accept-Language: en-US,en;q=0.5

Accept-Encoding: gzip, deflate

Referer: http://OurDomainHere.com/app/ProctorEvaluation/index.cfm?fuseaction=Clinical_Reps&MenuID=245

Cookie: JSESSIONID=0AB5CC6E492ACF4D77E2570C6FD6BF7C.cfusion; LASTUSERLOGINID=xxxxxx2; SHORTNAME=xxxxxx2; ADSHORTNAME=xxxxxx2; USERNAME=CN ME; RESPONSE=%294%3BQ17%22%22%3AI%5ESZ; LASTVISIT=%7Bts%20%272017%2D02%2D22%2014%3A12%3A42%27%7D; TOKEN=C%28%3ED%2F%22%27W%2DI%5EWCWP%5BN%2AN%28%3ACM4%2AQ%40%2F%2EV%5C%5E%243M%5B6K%25%5F%5CQMK%205L%20%20; PWEXPIRE=999; CFID=1214; CFTOKEN=92917471

Connection: keep-alive

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 22, 2017 0
Advocate ,
Feb 23, 2017

Copy link to clipboard

Copied

Do these folders exist / do you know what they are.

Are there any mappings or rewrites including these folders?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 23, 2017 0
Engaged ,
Feb 22, 2017

Copy link to clipboard

Copied

One of the parts of upgrading is also updating older code to work with newer standards and tech.  What you are doing with cfinput can be easily replicated using jquery and ajax.  I advise anyone using cfinput and the other cfform family of tags to look for alternatives.  The cfform tags add a ton of unnecessary bloat and confusion as well as their js libraries are not current nor can you update them.

To your actual question.  Can you please let us know what the actual error you are receiving is?  It is hard to assist without knowing that critical part.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 22, 2017 0
Adobe Community Professional ,
Feb 23, 2017

Copy link to clipboard

Copied

@tys62838125, it is unlikely that this is caused just by your move to ColdFusion 2016. I tested your code in ColdFusion 2016, placing the following 2 files in the same directory:

testPage.cfm

<cfform>

     <cfinput name="cfautosuggestvalue">

     <cfinput onFocus="textHighlight('textedit')" type="text" name="Clinical_Rep_Auto" size="50" maxlength="50" value="" autosuggest="cfc:autosuggest.findClinicalNameWithNetID({cfautosuggestvalue})" autosuggestminlength="2" maxresultsdisplayed="20" />

</cfform>

autosuggest.cfc

<cfcomponent>

<cffunction name="findClinicalNameWithNetID" access="remote"  returntype="array">

    <cfargument name="suggestedValue" required="true" type="string">

    <cfset var item = arrayNew(1)>

    <cfset item[1]="aspirin">   

    <cfreturn item>

</cffunction>

</cfcomponent>

When I open the CFM page in the browser and enter the letters a and s, it works as expected.

The moral: make sure the path to your form page is

/app/ProctorEvaluation/yourFormPage.cfm

The error message suggests that it is currently

/webRoot/inweb/app/ProctorEvaluation/yourFormPage.cfm

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 23, 2017 0
New Here ,
Feb 23, 2017

Copy link to clipboard

Copied

In IIS we have set the physical path of the site in question as "D:\webRoot\inweb," so yes those folders exist on the file server. By doing so the URL for our web apps can be listed as this:

"http://OurDomainHere.com/app/ProctorEvaluation/index.cfm"

instead of

http://OurDomainHere.com/webRoot/inweb/app/ProctorEvaluation/index.cfm

That's the same setup we had before. And to test the theory I changed the physical path to simply "D:" and, of course the CFC functions properly.

As I understand it, though, when the CFINPUT fires autosuggest it generates a javascript string as listed earlier in this thread and sends it to the browser, which runs and returns the results to the textbox. It's in the firing that "webRoot/inweb" is being added to the URL string. This doesn't happen on the older server and CF version. All paths are set up the same, etc. As Dave mentioned early regarding CFINPUT it uses an old library and perhaps it no longer functions the same way in CF2016. Just a thought. Either way, I'm not sure what the mechanics are of the firing portion of the javascript to understand how to work around it with our current IIS set up. I've been advised to simply pull the feature from the impacted web apps.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 23, 2017 0
Adobe Community Professional ,
Feb 26, 2017

Copy link to clipboard

Copied

Odd. We are assuming of course that the form page (index.cfm) and the CFC (autosuggest.cfc) are in the same directory. Then, as Haxtbh says, this behaviour also suggests a mapping. Is there a mapping to the CFC in the ColdFusion Administrator?

In any case, there is a workaround. Create the following mapping in the ColdFusion Administrator:

Logical Path: /proctorEvaluation

Directory Path: D:\webRoot\inweb\app\ProctorEvaluation

Then modify your code to:

<cfinput onFocus="textHighlight('textedit')" type="text" name="Clinical_Rep_Auto" size="50" maxlength="50" value="" autosuggest="cfc:proctorEvaluation.autosuggest.findClinicalNameWithNetID({cfautosuggestvalue})" autosuggestminlength="2" maxresultsdisplayed="20" />

This workaround has the advantage of leaving the rest of your code intact.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 26, 2017 0
New Here ,
Feb 26, 2017

Copy link to clipboard

Copied

Bingo!

I had at one time mapped a drive similarly, but it was before I observed the "webRoot/inweb" addition to the generated script, so I hadn't mapped it correctly.

The logical path you listed had to be tweaked since it didn't work right off, but it was the direction I needed to create the workaround. Many thanks, BKBK!

Final setup (which allows for any web app with a cfc file off the "/app" folder to function as before)

Logical Path: /app

Directory Path: D:\webRoot\inweb\app

autosuggest="cfc:proctorEvaluation(or any folder name where the web app resides).autosuggest.functionName...

Cheers,

Ty

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 26, 2017 0