7 Replies Latest reply on Apr 10, 2008 6:57 AM by nhe

    Invocation exception handling

      Hi all,
      on jira we currently have an issue about invocation exception handling with the metro stack http://jira.jboss.com/jira/browse/JBWS-1670.
      Basically the problem is caused by the handleInvocationException method of the abstract class org.jboss.wsf.spi.invocation.InvocationHandler that unwraps the throwable raised by the service endpoint implementation:

      if (th instanceof InvocationTargetException)
       {
       // Unwrap the throwable raised by the service endpoint implementation
       Throwable targetEx = ((InvocationTargetException)th).getTargetException();
       handleInvocationException(targetEx);
       }
      

      This is correct for the native stack, but causes the Metro stack integration to fail whenever a custom user exception is thrown, since the unwrapping process is perfomed twice (both by metro and jbossws code above).

      This drove me to think that the InvocationHandler might delegate the exception handling process to an InvocationExceptionHandler which is going to be different for each stack (for now, the native one would unwrap InvocationExceptions, the metro one would not).
      The EndpointHandlerDeploymentAspect could set the right InvocationExceptionHandler (according to the jbossws-xxx-config.xml) into every InvocationHandler (regardless of its type, the container we are running on, etc).

      Any opinion about this?
      Bye
      Alessio Soldano

        • 1. Re: Invocation exception handling
          thomas.diesler

          How about moving

          if (th instanceof InvocationTargetException)
           {
           // Unwrap the throwable raised by the service endpoint implementation
           Throwable targetEx = ((InvocationTargetException)th).getTargetException();
           handleInvocationException(targetEx);
           }
          


          to native and only unwrap the MBeanException as part of the SPI.

          Currently, the InvocationHandler = f(container). It'll be difficult ot make it f(container,stack)

          • 2. Re: Invocation exception handling
            thomas.diesler

            I've done the above. Maybe you could have a look if this fixes the Metro issue

            • 3. Re: Invocation exception handling

               

              "thomas.diesler@jboss.com" wrote:
              I've done the above. Maybe you could have a look if this fixes the Metro issue


              Yes, I did some tests and it fixes the Metro issues, thus I've just removed the "FIXME" in the framework jaxws/exception test.
              Thank you

              • 4. Re: Invocation exception handling
                yhrn

                Hi,
                I still have this behaviour. My environement is JBoss AS 4.2.2. with jbossws-3.0-metro-1.0.0.GA.

                All wsdl fault exceptions that are thrown by my EJB3 web service implementation are wrapped in a WebServiceException in org.jboss.wsf.stack.sunri.InvokerEJB3.handleException (line 117). Hence, a JAX-WS client receives a SoapFaultException with a WebServiceException as cause that in turn has the "real" exception as cause.

                I've tried web services generated from WSDL and also simple examples where I manually annotated java classes.

                This is a showstopper for us, so please help.

                Regards, Mattias

                • 5. Re: Invocation exception handling
                  asoldano

                  Could you please create a new jira issue and attach a simple test case showing what you said? The current implementation of the exception handling with the metro stack is tested through the framework testsuite (see org.jboss.test.ws.jaxws.samples.exception.ExceptionTestCase). May be the exception your enpoint raises is not declared as a fault in the contract?

                  • 6. Re: Invocation exception handling
                    yhrn

                    Ok,
                    I have created a new JIRA http://jira.jboss.com/jira/browse/JBWS-2087

                    • 7. Re: Invocation exception handling

                      Hi,
                      I have, as a workaround, in InvokerEJB3.handleException wrapped checked exceptions into InvocationTargetExceptions.

                      Maybe a solution would be to change the InvocationHandler to first unwrap the MBeanException and then wrap it into a InvocationTargetException.

                      /Niklas