[jboss-dev-forums] [Design of JBoss Remoting, Unified Invokers] - Exception propagation using HTTP servlet transport on 1.4.4

Cyberax do-not-reply at jboss.com
Fri Dec 8 19:27:42 EST 2006


There's a bug in ServletServerInvoker in 1.4.4 version of remoting.

'processRequest' methods do not support propagation of exceptions to remote clients.

This code:

  |          try
  |          {
  |             // call transport on the subclass, get the result to handback
  |             invocationResponse = invoke(invocationRequest);
  |          }
  |          catch(Throwable ex)
  |          {
  |             log.debug("Error thrown calling invoke on server invoker.", ex);
  |             invocationResponse = ex;
  |             isError = true;
  |          }
  | 
  |          //Start with response code of 204 (no content), then if is a return from handler, change to 200 (ok)
  |          int status = 204;
  |          if(invocationResponse != null)
  |          {
  |             if(isError)
  |             {
  |                response.sendError(500, "Error occurred processing invocation request. ");
  |             }
  |             else
  |             {
  |                status = 200;
  |             }
  |          }
  | 
sends "500 Server Error" message in response body to client. Client then tries to unmarshal this message using ObjectInputStream and fails.

The simple fix is:

  |          try
  |          {
  |             // call transport on the subclass, get the result to handback
  |             invocationResponse = invoke(invocationRequest);
  |          }
  |          catch(Throwable ex)
  |          {
  |             log.debug("Error thrown calling invoke on server invoker.", ex);
  |             invocationResponse = ex;
  | 
  | 	        String sessionId=null;
  | 	        if (invocationRequest instanceof InvocationRequest)
  | 	           sessionId=((InvocationRequest)invocationRequest).getSessionId();
  |             invocationResponse=new InvocationResponse(sessionId,ex,true,null);
  |             //isError = true;
  |          }
  | 

It seems to be working for me.

Should I create JIRA bug for this issue?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3992391#3992391

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3992391



More information about the jboss-dev-forums mailing list