2012-04-10 7 views
1

cfcでメソッドを呼び出すときに500エラーが発生します。どんな種類のデバッグ情報も得ていないので、何が起こっているのか把握するのには苦労しています。私はログを見ましたが、何が起こっているかを示すものはありません。私はここでPOSTcfcで500エラー

を使用してCFCを呼び出すためにjqueryの.ajaxを使用して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); 
     }); 
    });  
}); 

CFCのメソッドが今はかなり基本的なものです:

<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> 

ここにスタックトレースがあります:

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) 

私は困惑しています。実際のデバッグ情報がなくても、私は立ち往生しています。何か案は?

答えて

4

あなたのCFCのメソッドのアクセス属性は、Ajax呼び出し(またはFlexアプリケーションのサービスのようなもの)ではリモートである必要があります。基本的には、リモートへのアクセス権が設定されていない場合は、その呼び出しが行われたときに問題のメソッドが「使用可能」ではありません。

試してみてください。

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

私はそれが問題だと思って、私はまだ同じエラーを取得しています前に、あることを試してみました。 –

+1

しかし、それは遠隔でなければならない:)。 jQueryから$ .getJSON(http://api.jquery.com/jQuery.getJSON/)呼び出しを使用しようとしましたか(対$ .ajax): $ .getJSON( "/ url/or/path/to/your /cfc.cfc "、{ メソッド: 'update_profile'、 theJSON:yourdata、 returnformat: 'json' }、function(data){alert(data);}); –

+0

私はしていません。私はそれを試してみましょう。私はかなりjqueryに新しいので、これはすべての試行錯誤です(私が認めたいと思う以上のエラー:))。 –