Hey ZhiYong What release are you using ? This might have already been fixed by TUSCANY-1961 by adding the following code
JSONRPCResult errorResult = new JSONRPCResult(JSONRPCResult.CODE_REMOTE_EXCEPTION, id, e.getCause() ); Please let me know if you still see the mentioned behavior with current code. [1] https://issues.apache.org/jira/browse/TUSCANY-1961 On Sun, Oct 19, 2008 at 11:28 PM, ZhiYong Mao <[EMAIL PROTECTED]> wrote: > Hi > > I found there would be an error "error parsing result" while call by > JSON-RPC and we could not get the actual error message if the java code > threw a exception, which results from the error message is not valid JSON > string, for example: > {"error":com.ibm.iq.innovation.marketplace.biz.exception.BizException: A > Group named Jacky's team already exists.,"id":2} > > So I think it would be better to fix it like this: > =>Line 246 in > org.apache.tuscany.sca.binding.jsonrpc.provider.JSONRPCServiceServlet: > Change the following code: => > jsonResponse.put("error", e.getCause()); > to the code as follows: => > /********************************************************** > * add json error object into error so that > * the client javascript can parse them correctly. > */ > Throwable t=e.getCause(); > JSONObject jsonError = new JSONObject(); > jsonError.put("code", HttpServletResponse.SC_INTERNAL_SERVER_ERROR); > jsonError.put("msg", t.getMessage()); > jsonError.put("trace", t.getClass().getName()); > jsonResponse.put("error", jsonError); > /************************************************/ > > Best regards! > > Jacky Mao , Software Engineer > IBM GPSG Wuhan Perform Center > Tel : 0086-027-87406266-1212 > E-Mail: [EMAIL PROTECTED] -- Luciano Resende Apache Tuscany, Apache PhotArk http://people.apache.org/~lresende http://lresende.blogspot.com/