[jboss-user] [Remoting] - Re: Exception propagation using servlet transport

dpfelten do-not-reply at jboss.com
Sat Nov 15 12:42:15 EST 2008


Ron -

I'm also receiving this error (and working with Sean on the problem).  We can definitely verify that the EJB3 is being called - by using a breakpoint, we can stop before the RemoteException gets thrown, then step the whole way down the stack until we get to ServletServerInvoker.

The code that gets invoked in ServletServerInvoker is the following:
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 = null;
  |             response.sendError(500, "Error processing invocation request.  " + ex.getMessage());
  |          }

What should happen, from what I gather at least, is that the invocationResponse should be a marshalled exception that's then returned to the client.  But in org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke, it catches an exception on newSi.invokeNext() and tries to marshal the exception.  However, during the marshalling of the exception, it sees that it isn't a local call so it just re-throws the same exception.  See here:

public static InvocationResponse marshallException(Invocation invocation, Throwable exception, Map responseContext) throws Throwable
  |    {
  |       if (invocation.getMetaData(IsLocalInterceptor.IS_LOCAL,IsLocalInterceptor.IS_LOCAL) == null) throw exception;
  | 
  |       InvocationResponse response = new InvocationResponse();
  |       response.setContextInfo(responseContext);
  | 
  |       response.addAttachment(IsLocalInterceptor.IS_LOCAL_EXCEPTION, new MarshalledObjectForLocalCalls(exception));
  | 
  |       return response;
  |    }
  | 

The if statement is true, so it throws the exception, which is caught in ServletServerInvoker (in the code sample above).  It then rolls over the exception and sends back a 500 error with the given error message.

On the client, we can see in HTTPClientInvoker.useHttpURLConnection, this condition happening:
if(result instanceof String)
  |                   {
  |                      // this is a html error page displayed by web server, need to conver to exception
  |                      WebServerError ex = new WebServerError((String)result);
  |                      return ex;
  |                   }
  | 

The result is the HTML as specified in the error Sean pointed out earlier in the thread, and the local variable metadata contains the headers including the 500 return code, the error message from the ServletServerInvoker, etc.

Hope this helps narrow things down for you.  At this point, I think we need either a different configuration to avoid the code in question to modify the code to handle exceptions.  Or something you suggest :-)

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

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



More information about the jboss-user mailing list