Announcement Announcement Module
No announcement yet.
RemoteAccessException defect in HessianClientInterceptor Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • RemoteAccessException defect in HessianClientInterceptor

    Good day,

    If this issue was already debated I am sorry but I didn't find it.

    I am using hessian 4.0.3 and spring 3.0.1 (spring-remoting is the component in question here) and I ran into a big problem when using the HessianProxyFactoryBean when creating a Hessian service.

    The problem resides in the class HessianClientInterceptor, which HessianProxyFactoryBean extends. Everytime I throw a business exception (which is meaningfull to my system) I get in my client side a RemoteAccessException (totally meaningless...). In order to know if it was some bug or if it was part of the business logic, I have to "unpack" this exception... I am sure you will agree this is not pretty nor is it right.

    The expected behaviour of such proxy is that the exceptions declared in my service interface (normally business exceptions or of value to my business) are in fact caught directly in my client, not that they are wrapped around by some other meaningless exception.

    To solve this problem we had to create a class which extended HessianProxyFactoryBean and use it to create the bean. It would be nice if the invoke method instead of wrapping the exceptions would just throw them.

    this is the class we created:

    public class MyHessianProxyFactoryBean extends HessianProxyFactoryBean{
      public Object invoke(MethodInvocation invocation) throws Throwable {
          try {
            return super.invoke(invocation);
          }catch(RemoteConnectFailureException e) {
            throw e;     
          } catch(RemoteAccessException e) {
            if (e.getRootCause() != null)
              throw e.getRootCause();
              throw e;
    It was quite fast to make it and include it... but I would say this should be unnecessary and the way it is now is not the right behaviour. Should I open a jira issue about it or not really?

  • #2
    The jira bug is here:


    • #3
      I would make it more intelligent here, check if there is a root exception and see if that exception is part of the throws clause of the proxy, if so throw it else throw the RemoteAccessException. If you don't you might end up with exceptions which you don't want and if you have some aspect int here which does something with the generic RemoteAccessException that breaks. The RemoteAccessException is there for a reason and that reason is a unified/clear approach of catching a single type of exception, which is especially usefull if you mix different strategies (hession, rmi, ejb for instance) if you now implement your way this would break because now RAE is thrown anymore (there is almost always a rootcause).

      This is also the way the JAXRPC/RMI/EJB stuff works, so I guess this is an oversight in the Hessian/Burlap implementations.
      Last edited by Marten Deinum; Feb 25th, 2010, 03:13 AM.


      • #4
        That seems like a good idea and the way to go.

        Thanks for the reply and the explanation why the RAE is there.


        • #5
          I also added a comment to the JIRA.