问题
I'm at a loss.
I'm posting to a Coldfusion8 cfc via Ajax and while it works fine on my local machine, on the live server I cannot call any function in this CFC or it's extended CFC.
I want to do this:
<cfset LOCAL.response = THIS.commit() />
If I dump:
<cfdump output="e:\path\to\dump.txt" label="catch" var="committing">
<cfdump output="e:\path\to\dump.txt" label="catch" var="#THIS#">
<cfset dickhead = THIS.Commit() >
<cfdump output="e:\path\to\dump.txt" label="catch" var="out">
I'm getting:
committing
****************************************************************
catch - component services.form_service_user
extends controllers.form_switch
Methods:
DEFAULTS
[function]
Arguments: none
ReturnType: struct
Roles:
Access: public
Output: false
DisplayName:
Description:
PROCESS
[function]
Arguments: none
ReturnType: struct
Roles:
Access: remote
Output: true
DisplayName:
Description:
COMMIT
[function]
Arguments: none
ReturnType: struct
Roles:
Access: public
Output: false
Description:
...
So the methods/functions are there. But I'm not getting to out. Also I have cleared out the commit function except for a lone return value and a dump. I'm neither getting the dump nor the return value.
QUESTION:
If I'm inside PROCESS, why can I not call COMMIT on the live server when it works fine on production? Is this some kind of caching or whatever setting? Also, I don't have access to the CFadmin, so I'm more or less guessing blind?
Thanks for any infos!
EDIT:
The commit call is inside a try/catch:
<cftry>
<cfdump output="e:\dump.txt" label="catch" var="a">
<cfdump output="e:\dump.txt" label="catch" var="#THIS#">
<cfset LOCAL.Response = THIS.Commit() >
<cfdump output="e:\dump.txt" label="catch" var="b">
<!--- COMMIT ERRORS --->
<cfcatch>
<cfdump output="e:\dump.txt" label="catch" var="ERROR">
<cfset LOCAL.Response.Success = false />
<cfset LOCAL.Response.Errors = [["server_error","commit error"]] />
</cfcatch>
</cftry>
I'm getting the "commit error" returned by AJAX
回答1:
Check the access attribute on your methods.
If you are calling a method in a component (or inherited from a parent component) from another method in the same component, then access must be private, public or package. It cannot be remote.
Make sure your ColdFusion mappings are correct for the live server.
Make sure you have deployed all of the application files to the live server in the right location.
来源:https://stackoverflow.com/questions/11367653/why-i-cant-call-functions-in-a-coldfusion-cfc-on-live-server-when-it-works-on-p