500 error in cfc

I am getting a 500 error when I try calling a method in a cfc. Since I am not getting any kind of debugging information, I am struggling to figure out what is going on. I have looked at the logs, and nothing is there that would indicate what is going on. I am using jquery .ajax to call the cfc using POST

Here is the jquery:

$("#edit_button").click(function(){
    if(theArray.length > 0){
        theJson = JSON.stringify(theArray);
    }
    $.ajax({type:"POST",
            url: "/CFCs/fund_profile.cfc?method=updateProfile",
            data:theJson,
            dataType:"json",
            success:(function(response){
                var content = ''
                response = JSON.parse(response);    
                alert("the response is" + response);
        });
    });     
});

The the method in the cfc is pretty basic right now:

<cffuntion name="updateProfile" access="public" returnFormat="json">
    <cfargument name="theJson">
     <cfif isJson(theJson)>
         <cfset var theArray = deserializeJson(theJson)>
         <cfset var passingJson = serializeJson(theArray)>
     </cfif>
     <cfreturn passingJson>

here is the stack trace:

500

javax.servlet.ServletException
    at coldfusion.xml.rpc.CFCServlet.invoke(CFCServlet.java:154)
    at coldfusion.xml.rpc.CFCServlet.doPost(CFCServlet.java:289)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
    at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)
    at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
    at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
    at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
    at jrun.servlet.FilterChain.service(FilterChain.java:101)
    at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
    at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
    at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286)
    at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)
    at jrun.servlet.http.WebService.invokeRunnable(WebService.java:172)
    at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)
    at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
    at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)
    at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)

I'm stumped, and without any kind of real debugging information to go on, I'm stuck. Any ideas?

Answers


Your CFC's method's access attribute needs to be remote for Ajax calls (or from something like a Flex app's service). Essentially, without the access set to remote, the method in question is not "available" when that call is made.

Try:

<cffunction name="updateProfile" access="remote" returnFormat="json">
  ...
</cffunction>

Need Your Help

Cannot Access MySQL installed in Virtual Machine

mysql virtual-machine vmware

I install MySQL in xubuntu 15.04 which is installed in VMware.

Changing elements in datagridview

c# winforms datagridview

I have been struggling the past few days to change the color of rows in a datagridview depending on the date displayed in one of the cells. I've looked at many examples on here but none of them have