Uploaded image for project: 'Application Server 7'
  1. Application Server 7
  2. AS7-194

java.lang.reflect.UndeclaredThrowableException when using @ApplicationException in combination with @InterceptorBinding

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 7.0.0.Final
    • None
    • CDI / Weld, EJB
    • None
    • Hide

      The workaround is not to use annotation with @InterceptorBinding but this is not really satisfying.

      Show
      The workaround is not to use annotation with @InterceptorBinding but this is not really satisfying.

      If I'm using @InterceptorBinding a thrown Exception out of an EJB marked with @ApplicationException dont reach the client. Instead of the @ApplicationException I get a java.lang.reflect.UndeclaredThrowableException.

      I've attached a minimal example.

      My client-main-program looks like this:

      Bar.java
      public static void main(final String[] args) throws NamingException {
                                                                                                                        	                                                                                 
      	final InitialContext context = new InitialContext();                             
      	context.lookup("StatefulTestBean/remote");                                       
      	                                                                                 
      	try {                                                                            
      		statefulTest.throwApplicationError();                                        
      	} catch (final Exception e) {                                                    
      		System.out.println(e);                                                       
      	}                                                                                
      }                                                                                    
      

      The excepted output would be:

      error.AppError
      

      but its:

      java.lang.reflect.UndeclaredThrowableException
      

      If you comment out the annotation @InterceptorAnnotation in the StatefulTestBean.java and redeploy the application then everything is fine - you get the expetced AppError-Exception.

              sdouglas1@redhat.com Stuart Douglas (Inactive)
              windigo_jira Felix Ullrich (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: